From 5b869c23498487c6252cf909e0f879106caa88ed Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 5 Sep 2013 15:05:26 -0700 Subject: [PATCH] Fix arc + svn + delted binary file with properties + image heuristic 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 | 5 ++++- .../api/__tests__/ArcanistRepositoryAPIStateTestCase.php | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php index 8a32378b..ce9767ed 100644 --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -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 <<getSVNProperty($path, 'svn:mime-type'); if ($mime != 'application/octet-stream') { execx( 'svn propset svn:mime-type application/octet-stream %s', diff --git a/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php b/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php index 13c82203..ecc7dd60 100644 --- a/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php +++ b/src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php @@ -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); } -- 2.43.0