mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +01:00
Add a "--no-amend" flag to "arc diff"
Summary: This flag blocks amends. Test Plan: Ran "arc diff --no-amend" ooooooh meta Reviewers: davidreuss, btrahan Reviewed By: davidreuss CC: aran, epriestley Maniphest Tasks: T822 Differential Revision: https://secure.phabricator.com/D1539
This commit is contained in:
parent
eaa565747e
commit
bea4cd83d7
1 changed files with 9 additions and 2 deletions
|
@ -265,6 +265,9 @@ EOTEXT
|
|||
'help' =>
|
||||
'Emit machine-readable JSON. EXPERIMENTAL! Probably does not work!',
|
||||
),
|
||||
'no-amend' => array(
|
||||
'help' => 'Never amend commits in the working copy.',
|
||||
),
|
||||
'*' => 'paths',
|
||||
);
|
||||
}
|
||||
|
@ -445,7 +448,7 @@ EOTEXT
|
|||
if ($this->requiresRepositoryAPI()) {
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
if (($repository_api instanceof ArcanistGitAPI) &&
|
||||
!$this->isHistoryImmutable()) {
|
||||
$this->shouldAmend()) {
|
||||
echo "Updating commit message...\n";
|
||||
$repository_api->amendGitHeadCommit($revised_message);
|
||||
}
|
||||
|
@ -954,6 +957,10 @@ EOTEXT
|
|||
}
|
||||
}
|
||||
|
||||
private function shouldAmend() {
|
||||
return !$this->isHistoryImmutable() && !$this->getArgument('no-amend');
|
||||
}
|
||||
|
||||
|
||||
/* -( Lint and Unit Tests )------------------------------------------------ */
|
||||
|
||||
|
@ -979,7 +986,7 @@ EOTEXT
|
|||
}
|
||||
$lint_workflow = $this->buildChildWorkflow('lint', $argv);
|
||||
|
||||
if (!$this->isHistoryImmutable()) {
|
||||
if (!$this->shouldAmend()) {
|
||||
// TODO: We should offer to create a checkpoint commit.
|
||||
$lint_workflow->setShouldAmendChanges(true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue