]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix arc + svn + delted binary file with properties + image heuristic
authorepriestley <git@epriestley.com>
Thu, 5 Sep 2013 22:05:26 +0000 (15:05 -0700)
committerepriestley <git@epriestley.com>
Thu, 5 Sep 2013 22:05:26 +0000 (15:05 -0700)
Summary:
See IRC. This fixes an issue when deleting an SVN file that ends with one of the extensions in the regexp, which may only affect newer versions of SVN.

Possibly we shouldn't have this heuristic, or should move it elsewhere or make it more explicit, but at least stop it from being broken for now.

Test Plan: Ran `arc diff --only` in a working copy with a deleted binary file ending in ".jpg".

Reviewers: btrahan, nh

Reviewed By: nh

CC: aran, mbishopim3
Differential Revision: https://secure.phabricator.com/D6893

src/repository/api/ArcanistSubversionAPI.php
src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php

index 8a32378b418d7f0db91af16ceebdab1d28e2527e..ce9767ed2603d95b1e6a3bd9025d326f3621ce89 100644 (file)
@@ -390,7 +390,8 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
     // TODO: Move this to configuration?
     $matches = null;
     if (preg_match('/\.(gif|png|jpe?g|swf|pdf|ico)$/i', $path, $matches)) {
-      $mime = $this->getSVNProperty($path, 'svn:mime-type');
+      // Check if the file is deleted first; SVN will complain if we try to
+      // get properties of a deleted file.
       if ($status & ArcanistRepositoryAPI::FLAG_DELETED) {
         return <<<EODIFF
 Index: {$path}
@@ -400,6 +401,8 @@ svn:mime-type = application/octet-stream
 
 EODIFF;
       }
+
+      $mime = $this->getSVNProperty($path, 'svn:mime-type');
       if ($mime != 'application/octet-stream') {
         execx(
           'svn propset svn:mime-type application/octet-stream %s',
index 13c822031f9ba19784e4c706ec3f8b25efdafae5..ecc7dd605f16074c16348cc76a88b090cb6d6c41 100644 (file)
@@ -37,6 +37,12 @@ final class ArcanistRepositoryAPIStateTestCase extends ArcanistTestCase {
       $working_copy);
     $api->setBaseCommitArgumentRules('arc:this');
 
+    if ($api instanceof ArcanistSubversionAPI) {
+      // Upgrade the repository so that the test will still pass if the local
+      // `svn` is newer than the `svn` which created the repository.
+      $api->execxLocal('upgrade');
+    }
+
     $this->assertCorrectState($test, $api);
   }