]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make "no working copy" a more explicit "arc" VCS
authorepriestley <git@epriestley.com>
Tue, 3 Feb 2015 20:32:46 +0000 (12:32 -0800)
committerepriestley <git@epriestley.com>
Tue, 3 Feb 2015 20:32:46 +0000 (12:32 -0800)
Summary:
Some commands (like `get-config`) do not require a working copy at all. Recent changes prevented these commands from running outside a VCS working copy.

Let `null` mean "no working copy".

See also <https://github.com/phacility/phabricator/issues/800>.

Test Plan:
  - Ran `arc get-config` from outside a working copy.
  - Ran `arc list` from outside a working copy, got an error.
  - Ran `arc commit` in a Git working copy, got an error.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11643

scripts/arcanist.php
src/workflow/ArcanistShellCompleteWorkflow.php

index 737a01a82aa588726f527260b7636f6f2c600d38..c0bd76616f3389f8d9c1695018f9880d5c8f9285 100755 (executable)
@@ -202,17 +202,21 @@ try {
     $workflow->setConduitTimeout($conduit_timeout);
   }
 
+  $need_working_copy = $workflow->requiresWorkingCopy();
+
   $supported_vcs_types = $workflow->getSupportedRevisionControlSystems();
-  if (!in_array($working_copy->getVCSType(), $supported_vcs_types)) {
-    throw new ArcanistUsageException(
-      pht(
-        '`%s %s` is only supported under %s.',
-        'arc',
-        $workflow->getWorkflowName(),
-        implode(', ', $supported_vcs_types)));
+  $vcs_type = $working_copy->getVCSType();
+  if ($vcs_type || $need_working_copy) {
+    if (!in_array($vcs_type, $supported_vcs_types)) {
+      throw new ArcanistUsageException(
+        pht(
+          '`%s %s` is only supported under %s.',
+          'arc',
+          $workflow->getWorkflowName(),
+          implode(', ', $supported_vcs_types)));
+    }
   }
 
-  $need_working_copy    = $workflow->requiresWorkingCopy();
   $need_conduit         = $workflow->requiresConduit();
   $need_auth            = $workflow->requiresAuthentication();
   $need_repository_api  = $workflow->requiresRepositoryAPI();
index e5a2aacf9b8d384992d9cd2e95954aec635c7e7c..ca519903556ec98fe4b24db348a228b235b964c1 100644 (file)
@@ -82,8 +82,11 @@ EOTEXT
           continue;
         }
 
-        if (!in_array($vcs, $workflow->getSupportedRevisionControlSystems())) {
-          continue;
+        if ($vcs || $workflow->requiresWorkingCopy()) {
+          $supported_vcs = $workflow->getSupportedRevisionControlSystems();
+          if (!in_array($vcs, $supported_vcs)) {
+            continue;
+          }
         }
 
         $complete[] = $name;