]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't require clean working copy for `arc diff path` in SVN
authorvrana <jakubv@fb.com>
Fri, 14 Dec 2012 23:49:01 +0000 (15:49 -0800)
committervrana <jakubv@fb.com>
Fri, 21 Dec 2012 20:34:06 +0000 (12:34 -0800)
Summary: If you are explicit then there is no need to ask you.

Test Plan:
  $ touch a
  $ arc diff
  $ arc diff a
  $ arc diff existing

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4186

src/repository/api/ArcanistSubversionAPI.php
src/workflow/ArcanistDiffWorkflow.php

index 2d46e9f6087a44b9abf09e66799a71f790c860d0..74ab37a505668b8292255794f13c9fd54a178bfd 100644 (file)
@@ -15,6 +15,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
   protected $svnDiffRaw = array();
 
   private $svnBaseRevisionNumber;
+  private $statusPaths = array();
 
   public function getSourceControlSystemName() {
     return 'svn';
@@ -63,9 +64,20 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
     return $this->svnBaseRevisions;
   }
 
+  public function limitStatusToPaths(array $paths) {
+    $this->statusPaths = $paths;
+    return $this;
+  }
+
   public function getSVNStatus($with_externals = false) {
     if ($this->svnStatus === null) {
-      list($status) = $this->execxLocal('--xml status');
+      if ($this->statusPaths) {
+        list($status) = $this->execxLocal(
+          '--xml status %Ls',
+          $this->statusPaths);
+      } else {
+        list($status) = $this->execxLocal('--xml status');
+      }
       $xml = new SimpleXMLElement($status);
 
       if (count($xml->target) != 1) {
index bea10bd28428c5a809182c6e9c2238f2318a7392..6b5108635c3adb57e486bdeab47da0e5cadfd1cb 100644 (file)
@@ -616,6 +616,7 @@ EOTEXT
     }
 
     if ($this->requiresWorkingCopy()) {
+      $repository_api = $this->getRepositoryAPI();
       try {
         if ($this->getArgument('add-all')) {
           $this->setCommitMode(self::COMMIT_ENABLE);
@@ -624,9 +625,11 @@ EOTEXT
         } else {
           $this->setCommitMode(self::COMMIT_ALLOW);
         }
+        if ($repository_api instanceof ArcanistSubversionAPI) {
+          $repository_api->limitStatusToPaths($this->getArgument('paths'));
+        }
         $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