From: Nick Harper Date: Wed, 14 Mar 2012 06:42:05 +0000 (-0700) Subject: [svn1.7] handle removed directories in svn in arc diff X-Git-Tag: conduit-4~97 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7494a95c40e94559924d6943e02f6642c49b2073;p=arcanist.git [svn1.7] handle removed directories in svn in arc diff 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 --- diff --git a/src/parser/diff/ArcanistDiffParser.php b/src/parser/diff/ArcanistDiffParser.php index 716139a9..f8405bd2 100644 --- a/src/parser/diff/ArcanistDiffParser.php +++ b/src/parser/diff/ArcanistDiffParser.php @@ -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) { diff --git a/src/repository/api/subversion/ArcanistSubversionAPI.php b/src/repository/api/subversion/ArcanistSubversionAPI.php index b84cf44a..4498b60a 100644 --- a/src/repository/api/subversion/ArcanistSubversionAPI.php +++ b/src/repository/api/subversion/ArcanistSubversionAPI.php @@ -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); diff --git a/src/workflow/base/ArcanistBaseWorkflow.php b/src/workflow/base/ArcanistBaseWorkflow.php index 9cc5a18f..90909f08 100644 --- a/src/workflow/base/ArcanistBaseWorkflow.php +++ b/src/workflow/base/ArcanistBaseWorkflow.php @@ -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) {