]> khamidou — GitHub mirrors - arcanist.git/commitdiff
SVN buildSyntheticAdditionDiff: exit sooner if path is a directory
authorAllan Jude <allanjude@freebsd.org>
Sun, 5 Jun 2016 22:12:46 +0000 (15:12 -0700)
committerepriestley <git@epriestley.com>
Sun, 5 Jun 2016 22:12:46 +0000 (15:12 -0700)
Summary:
When doing svn copy, or svn mv, a SynthenticAdditionDiff is generated.

If the path is a directory, an error will occur when checking the
mime-type of the directory. Immediately after the properties check,
the function returns null if the path is a directory. Move this
check to before the properties check to avoid exiting with an error.

```
Command failed with error #1!
COMMAND
svn propget 'svn:mime-type' '/home/trasz/svn/ports/cad/py-pycam'@

STDOUT
(empty)

STDERR
svn: warning: W200017: Property 'svn:mime-type' not found on '/home/trasz/svn/ports/cad/py-pycam@'
svn: E200000: A problem occurred; see other errors for details

(Run with `--trace` for a full exception trace.)
```

Test Plan: Created differentials of changes with `svn copy` and `svn mv`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin

Tags: #subversion

Differential Revision: https://secure.phabricator.com/D15985

src/repository/api/ArcanistSubversionAPI.php

index 169f66ea9f1c477147396972b0061b0b0c0e245b..887fa4f3c73ecfaf30a440bad99b1a500edb2e82 100644 (file)
@@ -451,6 +451,10 @@ EODIFF;
   }
 
   protected function buildSyntheticAdditionDiff($path, $source, $rev) {
+    if (is_dir($this->getPath($path))) {
+      return null;
+    }
+
     $type = $this->getSVNProperty($path, 'svn:mime-type');
     if ($type == 'application/octet-stream') {
       return <<<EODIFF
@@ -462,10 +466,6 @@ svn:mime-type = application/octet-stream
 EODIFF;
     }
 
-    if (is_dir($this->getPath($path))) {
-      return null;
-    }
-
     $data = Filesystem::readFile($this->getPath($path));
     list($orig) = execx('svn cat %s@%s', $source, $rev);