]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix two arc issues
authorepriestley <git@epriestley.com>
Sat, 20 Oct 2012 13:13:12 +0000 (06:13 -0700)
committerepriestley <git@epriestley.com>
Sat, 20 Oct 2012 13:13:12 +0000 (06:13 -0700)
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

src/parser/ArcanistDiffParser.php
src/workflow/ArcanistDiffWorkflow.php

index 54a40361c9c991fc00f5f6dbd09e8344c85a144c..f4a0cc5c9dc080ea5ed956ecf9e1fc7291bc76a3 100644 (file)
@@ -1158,7 +1158,14 @@ final class ArcanistDiffParser {
       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());
index 175a4a84f57af87ead686a9388afed538c760b34..76437f3159d1e647e68ee0aed493422a573344b8 100644 (file)
@@ -588,6 +588,7 @@ EOTEXT
       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