1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

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
This commit is contained in:
epriestley 2013-09-05 15:05:26 -07:00
parent 67061480f9
commit 5b869c2349
2 changed files with 10 additions and 1 deletions

View 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',

View 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);
}