From: vrana Date: Fri, 21 Sep 2012 21:02:27 +0000 (-0700) Subject: Search for SVN commit in Git SVN repository X-Git-Tag: conduit-6~102 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=36acc9a01d0876971744deb285f25bb894e84c56;p=arcanist.git Search for SVN commit in Git SVN repository Summary: `arc patch` currently warns about "This diff is against commit svn+ssh://... but the commit is nowhere in the working copy" in Git SVN repository. Test Plan: $ arc patch # in Git SVN repository $ svn find-rev r121212112 # invalid revision Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3539 --- diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index d9b8465d..f640da07 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -384,8 +384,17 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { } public function getCanonicalRevisionName($string) { - list($stdout) = $this->execxLocal('show -s --format=%C %s', - '%H', $string); + $match = null; + if (preg_match('/@([0-9]+)$/', $string, $match)) { + list($stdout) = $this->execxLocal( + 'svn find-rev r%d', + $match[1]); + } else { + list($stdout) = $this->execxLocal( + 'show -s --format=%C %s', + '%H', + $string); + } return rtrim($stdout); } @@ -682,7 +691,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { public function hasLocalCommit($commit) { try { - $this->getCanonicalRevisionName($commit); + if (!$this->getCanonicalRevisionName($commit)) { + return false; + } } catch (CommandException $exception) { return false; }