mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-18 09:48:38 +01:00
Add "--revision <id>" flag to "arc land"
Summary: Allow the user to pick a revision explicitly if they think they know what they're doing. Similar to "arc amend --revision", etc. Test Plan: Obviously compells a meta-test. Reviewers: btrahan, fratrik Reviewed By: fratrik CC: aran, epriestley Maniphest Tasks: T928 Differential Revision: https://secure.phabricator.com/D1753
This commit is contained in:
parent
6d17dd6030
commit
77262c0cff
1 changed files with 26 additions and 8 deletions
|
@ -82,6 +82,11 @@ EOTEXT
|
||||||
'project is marked as having an immutable history, this is '.
|
'project is marked as having an immutable history, this is '.
|
||||||
'the default behavior.',
|
'the default behavior.',
|
||||||
),
|
),
|
||||||
|
'revision' => array(
|
||||||
|
'param' => 'id',
|
||||||
|
'help' => 'Use the message from a specific revision, rather than '.
|
||||||
|
'inferring the revision based on branch content.',
|
||||||
|
),
|
||||||
'*' => 'branch',
|
'*' => 'branch',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -171,25 +176,38 @@ EOTEXT
|
||||||
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
|
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
|
||||||
}
|
}
|
||||||
|
|
||||||
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions(
|
$revision_id = $this->getArgument('revision');
|
||||||
$this->getConduit(),
|
if ($revision_id) {
|
||||||
array(
|
$revision_id = $this->normalizeRevisionID($revision_id);
|
||||||
'authors' => array($this->getUserPHID()),
|
$revisions = $this->getConduit()->callMethodSynchronous(
|
||||||
));
|
'differential.query',
|
||||||
|
array(
|
||||||
|
'ids' => array($revision_id),
|
||||||
|
));
|
||||||
|
if (!$revisions) {
|
||||||
|
throw new ArcanistUsageException("No such revision 'D{$revision_id}'!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions(
|
||||||
|
$this->getConduit(),
|
||||||
|
array(
|
||||||
|
'authors' => array($this->getUserPHID()),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if (!count($revisions)) {
|
if (!count($revisions)) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"arc can not identify which revision exists on branch '{$branch}'. ".
|
"arc can not identify which revision exists on branch '{$branch}'. ".
|
||||||
"Update the revision with recent changes to synchronize the branch ".
|
"Update the revision with recent changes to synchronize the branch ".
|
||||||
"name and hashes, or use 'arc amend' to amend the commit message at ".
|
"name and hashes, or use 'arc amend' to amend the commit message at ".
|
||||||
"HEAD.");
|
"HEAD, or use '--revision <id>' to select a revision explicitly.");
|
||||||
} else if (count($revisions) > 1) {
|
} else if (count($revisions) > 1) {
|
||||||
$message =
|
$message =
|
||||||
"There are multiple revisions on feature branch '{$branch}' which are ".
|
"There are multiple revisions on feature branch '{$branch}' which are ".
|
||||||
"not present on '{$onto}':\n\n".
|
"not present on '{$onto}':\n\n".
|
||||||
$this->renderRevisionList($revisions)."\n".
|
$this->renderRevisionList($revisions)."\n".
|
||||||
"Separate these revisions onto different branches, or manually land ".
|
"Separate these revisions onto different branches, or use ".
|
||||||
"them in '{$onto}'.";
|
"'--revision <id>' to select one.";
|
||||||
throw new ArcanistUsageException($message);
|
throw new ArcanistUsageException($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue