mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Don't fatal without Conduit for "--patch" and "--bundle"
Summary: In some workflows, we don't have Conduit at all, so we'll fail with a raw exception. Test for conduit presence before trying to make the encoding call. Also move some "instanceof" logic for updates into RepositoryAPI (factoring, windows compat). Test Plan: Ran "arc patch --patch some.patch". Reviewers: 20after4, davidreuss, nh, btrahan Reviewed By: 20after4 CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1935
This commit is contained in:
parent
f15479c832
commit
89753d5d49
5 changed files with 22 additions and 25 deletions
|
@ -160,6 +160,7 @@ abstract class ArcanistRepositoryAPI {
|
|||
abstract public function getCanonicalRevisionName($string);
|
||||
abstract public function supportsRelativeLocalCommits();
|
||||
abstract public function getWorkingCopyRevision();
|
||||
abstract public function updateWorkingCopy();
|
||||
abstract public function loadWorkingCopyDifferentialRevisions(
|
||||
ConduitClient $conduit,
|
||||
array $query);
|
||||
|
|
|
@ -672,4 +672,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
|||
return $results;
|
||||
}
|
||||
|
||||
public function updateWorkingCopy() {
|
||||
$this->execxLocal('pull');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -430,4 +430,8 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
|||
return $results;
|
||||
}
|
||||
|
||||
public function updateWorkingCopy() {
|
||||
$this->execxLocal('up');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -549,4 +549,8 @@ EODIFF;
|
|||
return $results;
|
||||
}
|
||||
|
||||
public function updateWorkingCopy() {
|
||||
$this->execxLocal('up');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -298,27 +298,9 @@ EOTEXT
|
|||
}
|
||||
|
||||
private function updateWorkingCopy() {
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
if ($repository_api instanceof ArcanistSubversionAPI) {
|
||||
execx(
|
||||
'(cd %s; svn up)',
|
||||
$repository_api->getPath());
|
||||
$message = "Updated to HEAD. ";
|
||||
} else if ($repository_api instanceof ArcanistGitAPI) {
|
||||
execx(
|
||||
'(cd %s; git pull)',
|
||||
$repository_api->getPath());
|
||||
$message = "Updated to HEAD. ";
|
||||
} else if ($repository_api instanceof ArcanistMercurialAPI) {
|
||||
execx(
|
||||
'(cd %s; hg up)',
|
||||
$repository_api->getPath());
|
||||
$message = "Updated to tip. ";
|
||||
} else {
|
||||
throw new Exception('Unknown version control system.');
|
||||
}
|
||||
|
||||
echo phutil_console_format($message."\n");
|
||||
echo "Updating working copy...\n";
|
||||
$this->getRepositoryAPI()->updateWorkingCopy();
|
||||
echo "Done.\n";
|
||||
}
|
||||
|
||||
public function run() {
|
||||
|
@ -367,10 +349,12 @@ EOTEXT
|
|||
|
||||
$try_encoding = nonempty($this->getArgument('encoding'), null);
|
||||
if (!$try_encoding) {
|
||||
try {
|
||||
$try_encoding = $this->getRepositoryEncoding();
|
||||
} catch (ConduitClientException $e) {
|
||||
$try_encoding = null;
|
||||
if ($this->requiresConduit()) {
|
||||
try {
|
||||
$try_encoding = $this->getRepositoryEncoding();
|
||||
} catch (ConduitClientException $e) {
|
||||
$try_encoding = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue