]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Expand ArcanistDiffParser to accept awkward Diffusion + SVN workflows.
authorepriestley <epriestley@phabricator.com>
Thu, 31 Mar 2011 02:33:50 +0000 (19:33 -0700)
committerepriestley <epriestley@phabricator.com>
Thu, 31 Mar 2011 02:33:50 +0000 (19:33 -0700)
src/parser/diff/ArcanistDiffParser.php

index 9e7a33a8ef22409d7469b44e6713ace6844d8f6e..a027e5c1cb10e3f6af6cfa706661a384389212c8 100644 (file)
@@ -30,6 +30,7 @@ class ArcanistDiffParser {
   protected $detectBinaryFiles = false;
 
   protected $changes = array();
+  private $forcePath;
 
   protected function setRepositoryAPI(ArcanistRepositoryAPI $api) {
     $this->api = $api;
@@ -45,6 +46,16 @@ class ArcanistDiffParser {
     return $this;
   }
 
+  public function forcePath($path) {
+    $this->forcePath = $path;
+    return $this;
+  }
+
+  public function setChanges(array $changes) {
+    $this->changes = mpull($changes, null, 'getCurrentPath');
+    return $this;
+  }
+
   public function parseSubversionDiff(ArcanistSubversionAPI $api, $paths) {
     $this->setRepositoryAPI($api);
 
@@ -732,6 +743,10 @@ class ArcanistDiffParser {
       }
     }
 
+    if ($this->forcePath) {
+      return $this->changes[$this->forcePath];
+    }
+
     $change = new ArcanistDiffChange();
     if ($path !== null) {
       $change->setCurrentPath($path);