]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Prefer Mercurial and Git over Subversion in discovering repository
authorvrana <jakubv@fb.com>
Mon, 26 Nov 2012 22:45:50 +0000 (14:45 -0800)
committervrana <jakubv@fb.com>
Tue, 27 Nov 2012 21:48:31 +0000 (13:48 -0800)
Summary: `svn info` is the slowest command for discovering repository (up to 300 ms) and Subversion is probably the least used repository type with Arcanist. Let's discover it last.

Test Plan:
  $ arc lint --trace

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4039

src/repository/api/ArcanistRepositoryAPI.php

index b27241ac8c3fef187c9591521a0d450e54f34e92..82f9fdcbb698f7cdfba03e1e70b11ed56f77a86e 100644 (file)
@@ -56,14 +56,6 @@ abstract class ArcanistRepositoryAPI {
         "any parent directory. Create an '.arcconfig' file to configure arc.");
     }
 
-    // check if we're in an svn working copy
-    list($err) = exec_manual('svn info');
-    if (!$err) {
-      $api = new ArcanistSubversionAPI($root);
-      $api->workingCopyIdentity = $working_copy;
-      return $api;
-    }
-
     if (Filesystem::pathExists($root.'/.hg')) {
       $api = new ArcanistMercurialAPI($root);
       $api->workingCopyIdentity = $working_copy;
@@ -83,6 +75,14 @@ abstract class ArcanistRepositoryAPI {
       return $api;
     }
 
+    // check if we're in an svn working copy
+    list($err) = exec_manual('svn info');
+    if (!$err) {
+      $api = new ArcanistSubversionAPI($root);
+      $api->workingCopyIdentity = $working_copy;
+      return $api;
+    }
+
     throw new ArcanistUsageException(
       "The current working directory is not part of a working copy for a ".
       "supported version control system (svn, git or mercurial).");