]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Speed up SVN discovery
authorvrana <jakubv@fb.com>
Fri, 21 Dec 2012 02:04:59 +0000 (18:04 -0800)
committervrana <jakubv@fb.com>
Fri, 21 Dec 2012 02:10:37 +0000 (18:10 -0800)
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

index 89f037dc07e5aea3f5d1bb73531d61816fc30664..694b5cb66fb92ad9350fa88532ca5c84a8d29f86 100644 (file)
@@ -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(