1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 16:32:39 +01:00

Make "no working copy" a more explicit "arc" VCS

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
This commit is contained in:
epriestley 2015-02-03 12:32:46 -08:00
parent 77eb24b13a
commit a08383aa1b
2 changed files with 17 additions and 10 deletions

View file

@ -202,8 +202,12 @@ try {
$workflow->setConduitTimeout($conduit_timeout); $workflow->setConduitTimeout($conduit_timeout);
} }
$need_working_copy = $workflow->requiresWorkingCopy();
$supported_vcs_types = $workflow->getSupportedRevisionControlSystems(); $supported_vcs_types = $workflow->getSupportedRevisionControlSystems();
if (!in_array($working_copy->getVCSType(), $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( throw new ArcanistUsageException(
pht( pht(
'`%s %s` is only supported under %s.', '`%s %s` is only supported under %s.',
@ -211,8 +215,8 @@ try {
$workflow->getWorkflowName(), $workflow->getWorkflowName(),
implode(', ', $supported_vcs_types))); implode(', ', $supported_vcs_types)));
} }
}
$need_working_copy = $workflow->requiresWorkingCopy();
$need_conduit = $workflow->requiresConduit(); $need_conduit = $workflow->requiresConduit();
$need_auth = $workflow->requiresAuthentication(); $need_auth = $workflow->requiresAuthentication();
$need_repository_api = $workflow->requiresRepositoryAPI(); $need_repository_api = $workflow->requiresRepositoryAPI();

View file

@ -82,9 +82,12 @@ EOTEXT
continue; continue;
} }
if (!in_array($vcs, $workflow->getSupportedRevisionControlSystems())) { if ($vcs || $workflow->requiresWorkingCopy()) {
$supported_vcs = $workflow->getSupportedRevisionControlSystems();
if (!in_array($vcs, $supported_vcs)) {
continue; continue;
} }
}
$complete[] = $name; $complete[] = $name;
} }