From 36acc9a01d0876971744deb285f25bb894e84c56 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 21 Sep 2012 14:02:27 -0700 Subject: [PATCH] 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 --- src/repository/api/ArcanistGitAPI.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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; } -- 2.43.0