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
if ($change->getNeedsSyntheticGitHunks()) {
$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);
+
foreach ($raw_changes as $raw_change) {
if ($raw_change->getCurrentPath() == $path) {
$change->setFileType($raw_change->getFileType());
try {
$this->requireCleanWorkingCopy();
} catch (ArcanistUncommittedChangesException $ex) {
+ $repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistMercurialAPI) {
// Some Mercurial users prefer to use it like SVN, where they don't