1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 18:22:41 +01:00

Fix two arc issues

Summary:
  - I caused $parser to be reused in D3732 which I belived was safe, but actually isn't. We end up writing to the same changes. We should make it safe but there's some mess in Phabricator that needs to be cleaned up first.
  - One minor error code thing, variable is undefined.

Test Plan: Ran `arc export --git` on a moved file, got a better result. Ran some command which made me hit the other case and didn't get a fatal anymore.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3749
This commit is contained in:
epriestley 2012-10-20 06:13:12 -07:00
parent 3853483c64
commit 7cb3551dc7
2 changed files with 8 additions and 0 deletions

View file

@ -1158,7 +1158,14 @@ final class ArcanistDiffParser {
if ($change->getNeedsSyntheticGitHunks()) { if ($change->getNeedsSyntheticGitHunks()) {
$diff = $repository_api->getRawDiffText($path, $moves = false); $diff = $repository_api->getRawDiffText($path, $moves = false);
// NOTE: We're reusing the parser and it doesn't reset change state
// between parses because there's an oddball SVN workflow in Phabricator
// which relies on being able to inject changes.
// TODO: Fix this.
$this->setChanges(array());
$raw_changes = $this->parseDiff($diff); $raw_changes = $this->parseDiff($diff);
foreach ($raw_changes as $raw_change) { foreach ($raw_changes as $raw_change) {
if ($raw_change->getCurrentPath() == $path) { if ($raw_change->getCurrentPath() == $path) {
$change->setFileType($raw_change->getFileType()); $change->setFileType($raw_change->getFileType());

View file

@ -588,6 +588,7 @@ EOTEXT
try { try {
$this->requireCleanWorkingCopy(); $this->requireCleanWorkingCopy();
} catch (ArcanistUncommittedChangesException $ex) { } catch (ArcanistUncommittedChangesException $ex) {
$repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistMercurialAPI) { if ($repository_api instanceof ArcanistMercurialAPI) {
// Some Mercurial users prefer to use it like SVN, where they don't // Some Mercurial users prefer to use it like SVN, where they don't