]> khamidou — GitHub mirrors - arcanist.git/commitdiff
[svn1.7] handle removed directories in svn in arc diff
authorNick Harper <nharper@nharper.org>
Wed, 14 Mar 2012 06:42:05 +0000 (23:42 -0700)
committerNick Harper <nharper@nharper.org>
Wed, 14 Mar 2012 06:45:37 +0000 (23:45 -0700)
Summary:
`svn rm $directory` removes the directory and its contents in svn 1.7, whereas
svn 1.6 only removes the directory's contents, so arc diff needs to not try
to read the directory.

Test Plan:
ran arc diff in a svn working copy that had a directory removed (with both
svn 1.6 and svn 1.7) and confirmed that the command did not throw an exception,
and that the removed directory was marked as directory (not a file).

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1889

src/parser/diff/ArcanistDiffParser.php
src/repository/api/subversion/ArcanistSubversionAPI.php
src/workflow/base/ArcanistBaseWorkflow.php

index 716139a9b0c975ebca557e1fa3df5e968e075a7c..f8405bd24b7cfa4cec66b1e71416c0302d8b2732 100644 (file)
@@ -132,6 +132,12 @@ final class ArcanistDiffParser {
 
         $from[$path] = $cpath;
       }
+      $type = $change->getType();
+      if (($type === ArcanistDiffChangeType::TYPE_MOVE_AWAY ||
+           $type === ArcanistDiffChangeType::TYPE_DELETE) &&
+          idx($info, 'Node Kind') === 'directory') {
+        $change->setFileType(ArcanistDiffChangeType::FILE_DIRECTORY);
+      }
     }
 
     foreach ($paths as $path => $status) {
index b84cf44ae484890e5ef49af5c8bfb3b7a9d414d0..4498b60a0026747e078d26a81cd808597abef1bc 100644 (file)
@@ -291,6 +291,7 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
         '/^(Copied From URL): (\S+)$/m',
         '/^(Copied From Rev): (\d+)$/m',
         '/^(Repository UUID): (\S+)$/m',
+        '/^(Node Kind): (\S+)$/m',
       );
 
       $result = array();
@@ -426,6 +427,10 @@ EODIFF;
       return null;
     }
 
+    if (!file_exists($full_path)) {
+      return null;
+    }
+
     $data = Filesystem::readFile($full_path);
     $lines = explode("\n", $data);
     $len = count($lines);
index 9cc5a18f8943d5c90f65aa77a0a5eb043fb98b58..90909f083fa396d4b4b5d224e3c4b9851542e37f 100644 (file)
@@ -753,6 +753,10 @@ abstract class ArcanistBaseWorkflow {
       return null;
     }
 
+    if (!file_exists($full_path)) {
+      return null;
+    }
+
     $change = $this->getChange($path);
 
     if ($change->getFileType() !== ArcanistDiffChangeType::FILE_TEXT) {