mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Replace "arc merge" with "arc land --merge" for git
Summary: I think "arc land" is better than "arc merge" in every case? Make "arc merge" hg-only (possibly nuke it later, see T614) and point users at "arc land". Add an explicit "--merge" flag to force --no-ff behavior in mutable reposiories. Test Plan: Ran "arc land --hold --merge <feature>" on this branch, got a clean merge. Reviewers: fratrik, btrahan Reviewed By: btrahan CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1647
This commit is contained in:
parent
964260b1e0
commit
085963501b
2 changed files with 31 additions and 20 deletions
|
@ -25,7 +25,7 @@ final class ArcanistLandWorkflow extends ArcanistBaseWorkflow {
|
|||
|
||||
public function getCommandHelp() {
|
||||
return phutil_console_format(<<<EOTEXT
|
||||
**land** __branch__ [--onto __master__]
|
||||
**land** [__options__] __branch__ [--onto __master__]
|
||||
Supports: git
|
||||
|
||||
Land an accepted change (currently sitting in local feature branch
|
||||
|
@ -34,8 +34,9 @@ final class ArcanistLandWorkflow extends ArcanistBaseWorkflow {
|
|||
|
||||
In mutable repositories, this will perform a --squash merge (the
|
||||
entire branch will be represented by one commit on __master__). In
|
||||
immutable repositories, it will perform a --no-ff merge (the branch
|
||||
will always be merged into __master__ with a merge commit).
|
||||
immutable repositories (or when --merge is provided), it will perform
|
||||
a --no-ff merge (the branch will always be merged into __master__ with
|
||||
a merge commit).
|
||||
|
||||
EOTEXT
|
||||
);
|
||||
|
@ -76,6 +77,11 @@ EOTEXT
|
|||
'param' => 'origin',
|
||||
'help' => "Push to a remote other than 'origin' (default).",
|
||||
),
|
||||
'merge' => array(
|
||||
'help' => 'Perform a --no-ff merge, not a --squash merge. If the '.
|
||||
'project is marked as having an immutable history, this is '.
|
||||
'the default behavior.',
|
||||
),
|
||||
'*' => 'branch',
|
||||
);
|
||||
}
|
||||
|
@ -90,7 +96,8 @@ EOTEXT
|
|||
|
||||
$remote = $this->getArgument('remote', 'origin');
|
||||
$onto = $this->getArgument('onto', 'master');
|
||||
$is_immutable = $this->isHistoryImmutable();
|
||||
$is_immutable = $this->isHistoryImmutable() ||
|
||||
$this->getArgument('merge');
|
||||
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
if (!($repository_api instanceof ArcanistGitAPI)) {
|
||||
|
@ -192,7 +199,7 @@ EOTEXT
|
|||
|
||||
if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
||||
$ok = phutil_console_confirm(
|
||||
"Revision 'D{$id}: {$rev_title}' has not been accepted. Continue ".
|
||||
"Revision 'D{$rev_id}: {$rev_title}' has not been accepted. Continue ".
|
||||
"anyway?");
|
||||
if (!$ok) {
|
||||
throw new ArcanistUserAbortException();
|
||||
|
@ -224,7 +231,7 @@ EOTEXT
|
|||
throw new ArcanistUsageException(
|
||||
"'git merge' failed. Your working copy has been left in a partially ".
|
||||
"merged state. You can: abort with 'git merge --abort'; or follow ".
|
||||
"the instructions to complete the merge, and then push.");
|
||||
"the instructions to complete the merge.");
|
||||
}
|
||||
} else {
|
||||
// In mutable histories, do a --squash merge.
|
||||
|
|
|
@ -27,19 +27,15 @@ final class ArcanistMergeWorkflow extends ArcanistBaseWorkflow {
|
|||
public function getCommandHelp() {
|
||||
return phutil_console_format(<<<EOTEXT
|
||||
**merge** [__branch__] [--revision __revision_id__] [--show]
|
||||
Supports: git, hg
|
||||
Execute a "git merge <branch>" or "hg merge --rev <branch>" of a
|
||||
reviewed branch, but give the merge commit a useful commit message
|
||||
with information from Differential.
|
||||
Supports: hg
|
||||
Execute a "hg merge --rev <branch>" of a reviewed branch, but give the
|
||||
merge commit a useful commit message with information from
|
||||
Differential.
|
||||
|
||||
In Git, this operates like "git merge <branch>" and should be executed
|
||||
from the branch you want to merge __into__, just like "git merge".
|
||||
Branch is required.
|
||||
|
||||
In Mercurial, this operates like "hg merge" (default) or
|
||||
"hg merge --rev <branch>" and should be executed from the branch you
|
||||
want to merge __from__, just like "hg merge". It will also effect an
|
||||
"hg commit" with a rich commit message.
|
||||
Tthis operates like "hg merge" (default) or "hg merge --rev <branch>"
|
||||
and should be executed from the branch you want to merge __from__,
|
||||
just like "hg merge". It will also effect an "hg commit" with a rich
|
||||
commit message if possible.
|
||||
|
||||
EOTEXT
|
||||
);
|
||||
|
@ -78,11 +74,19 @@ EOTEXT
|
|||
}
|
||||
|
||||
public function run() {
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
|
||||
if ($repository_api instanceof ArcanistGitAPI) {
|
||||
throw new ArcanistUsageException(
|
||||
"'arc merge' no longer supports git. Use ".
|
||||
"'arc land --keep-branch --hold --merge <feature_branch>' instead.");
|
||||
}
|
||||
|
||||
$this->writeStatusMessage(
|
||||
phutil_console_format(
|
||||
"**WARNING:** 'arc merge' is new and experimental.\n"));
|
||||
|
||||
$repository_api = $this->getRepositoryAPI();
|
||||
|
||||
if (!$repository_api->supportsLocalBranchMerge()) {
|
||||
$name = $repository_api->getSourceControlSystemName();
|
||||
throw new ArcanistUsageException(
|
||||
|
@ -157,7 +161,7 @@ EOTEXT
|
|||
}
|
||||
|
||||
protected function getSupportedRevisionControlSystems() {
|
||||
return array('git', 'hg');
|
||||
return array('hg');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue