1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 22:10:54 +01:00

Make --revision switch of amend workflow easier to use

Summary:
--revision doesn't allow the revision to be prefixed with 'D'.  Also the error
message showed when specified revision doesn't exist is hard to understand.

Test Plan:
Used `arc amend --revision D123`, tried it without 'D' and with a non existing
revision.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1193
This commit is contained in:
Marek Sapota 2011-12-13 11:38:45 -08:00
parent b5a104765a
commit 3abebbebfd

View file

@ -90,7 +90,7 @@ EOTEXT
} }
if ($this->getArgument('revision')) { if ($this->getArgument('revision')) {
$revision_id = $this->getArgument('revision'); $revision_id = $this->normalizeRevisionID($this->getArgument('revision'));
} else { } else {
$log = $repository_api->getGitCommitLog(); $log = $repository_api->getGitCommitLog();
$parser = new ArcanistDiffParser(); $parser = new ArcanistDiffParser();
@ -117,12 +117,23 @@ EOTEXT
// revision in it. Maybe this is worth restoring? // revision in it. Maybe this is worth restoring?
$conduit = $this->getConduit(); $conduit = $this->getConduit();
$message = $conduit->callMethodSynchronous( try {
'differential.getcommitmessage', $message = $conduit->callMethodSynchronous(
array( 'differential.getcommitmessage',
'revision_id' => $revision_id, array(
'edit' => false, 'revision_id' => $revision_id,
)); 'edit' => false,
)
);
} catch (ConduitClientException $ex) {
if (strpos($ex->getMessage(), 'ERR_NOT_FOUND') === false) {
throw $ex;
} else {
throw new ArcanistUsageException(
"Revision D{$revision_id} does not exist."
);
}
}
if ($is_show) { if ($is_show) {
echo $message."\n"; echo $message."\n";