From 940d91d7b587f6ced7ea2173c2c60089f11aeddd Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 20 Dec 2012 18:04:59 -0800 Subject: [PATCH] Speed up SVN discovery Summary: `svn info` takes up to 10 seconds. Test Plan: `arc diff` inside SVN repo and outside any repo. Reviewers: nh, epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4256 --- src/repository/api/ArcanistRepositoryAPI.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php index 89f037dc..694b5cb6 100644 --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -83,13 +83,12 @@ abstract class ArcanistRepositoryAPI { } // check if we're in an svn working copy - list($err) = id(new ExecFuture('svn info')) - ->setCWD($root) - ->resolve(); - if (!$err) { - $api = new ArcanistSubversionAPI($root); - $api->workingCopyIdentity = $working_copy; - return $api; + foreach (Filesystem::walkToRoot($root) as $dir) { + if (Filesystem::pathExists($dir . '/.svn')) { + $api = new ArcanistSubversionAPI($root); + $api->workingCopyIdentity = $working_copy; + return $api; + } } throw new ArcanistUsageException(