mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 16: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() {
|
public function getCommandHelp() {
|
||||||
return phutil_console_format(<<<EOTEXT
|
return phutil_console_format(<<<EOTEXT
|
||||||
**land** __branch__ [--onto __master__]
|
**land** [__options__] __branch__ [--onto __master__]
|
||||||
Supports: git
|
Supports: git
|
||||||
|
|
||||||
Land an accepted change (currently sitting in local feature branch
|
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
|
In mutable repositories, this will perform a --squash merge (the
|
||||||
entire branch will be represented by one commit on __master__). In
|
entire branch will be represented by one commit on __master__). In
|
||||||
immutable repositories, it will perform a --no-ff merge (the branch
|
immutable repositories (or when --merge is provided), it will perform
|
||||||
will always be merged into __master__ with a merge commit).
|
a --no-ff merge (the branch will always be merged into __master__ with
|
||||||
|
a merge commit).
|
||||||
|
|
||||||
EOTEXT
|
EOTEXT
|
||||||
);
|
);
|
||||||
|
@ -76,6 +77,11 @@ EOTEXT
|
||||||
'param' => 'origin',
|
'param' => 'origin',
|
||||||
'help' => "Push to a remote other than 'origin' (default).",
|
'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',
|
'*' => 'branch',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +96,8 @@ EOTEXT
|
||||||
|
|
||||||
$remote = $this->getArgument('remote', 'origin');
|
$remote = $this->getArgument('remote', 'origin');
|
||||||
$onto = $this->getArgument('onto', 'master');
|
$onto = $this->getArgument('onto', 'master');
|
||||||
$is_immutable = $this->isHistoryImmutable();
|
$is_immutable = $this->isHistoryImmutable() ||
|
||||||
|
$this->getArgument('merge');
|
||||||
|
|
||||||
$repository_api = $this->getRepositoryAPI();
|
$repository_api = $this->getRepositoryAPI();
|
||||||
if (!($repository_api instanceof ArcanistGitAPI)) {
|
if (!($repository_api instanceof ArcanistGitAPI)) {
|
||||||
|
@ -192,7 +199,7 @@ EOTEXT
|
||||||
|
|
||||||
if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
if ($revision['status'] != ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
||||||
$ok = phutil_console_confirm(
|
$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?");
|
"anyway?");
|
||||||
if (!$ok) {
|
if (!$ok) {
|
||||||
throw new ArcanistUserAbortException();
|
throw new ArcanistUserAbortException();
|
||||||
|
@ -224,7 +231,7 @@ EOTEXT
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
"'git merge' failed. Your working copy has been left in a partially ".
|
"'git merge' failed. Your working copy has been left in a partially ".
|
||||||
"merged state. You can: abort with 'git merge --abort'; or follow ".
|
"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 {
|
} else {
|
||||||
// In mutable histories, do a --squash merge.
|
// In mutable histories, do a --squash merge.
|
||||||
|
|
|
@ -27,19 +27,15 @@ final class ArcanistMergeWorkflow extends ArcanistBaseWorkflow {
|
||||||
public function getCommandHelp() {
|
public function getCommandHelp() {
|
||||||
return phutil_console_format(<<<EOTEXT
|
return phutil_console_format(<<<EOTEXT
|
||||||
**merge** [__branch__] [--revision __revision_id__] [--show]
|
**merge** [__branch__] [--revision __revision_id__] [--show]
|
||||||
Supports: git, hg
|
Supports: hg
|
||||||
Execute a "git merge <branch>" or "hg merge --rev <branch>" of a
|
Execute a "hg merge --rev <branch>" of a reviewed branch, but give the
|
||||||
reviewed branch, but give the merge commit a useful commit message
|
merge commit a useful commit message with information from
|
||||||
with information from Differential.
|
Differential.
|
||||||
|
|
||||||
In Git, this operates like "git merge <branch>" and should be executed
|
Tthis operates like "hg merge" (default) or "hg merge --rev <branch>"
|
||||||
from the branch you want to merge __into__, just like "git merge".
|
and should be executed from the branch you want to merge __from__,
|
||||||
Branch is required.
|
just like "hg merge". It will also effect an "hg commit" with a rich
|
||||||
|
commit message if possible.
|
||||||
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.
|
|
||||||
|
|
||||||
EOTEXT
|
EOTEXT
|
||||||
);
|
);
|
||||||
|
@ -78,11 +74,19 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run() {
|
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(
|
$this->writeStatusMessage(
|
||||||
phutil_console_format(
|
phutil_console_format(
|
||||||
"**WARNING:** 'arc merge' is new and experimental.\n"));
|
"**WARNING:** 'arc merge' is new and experimental.\n"));
|
||||||
|
|
||||||
$repository_api = $this->getRepositoryAPI();
|
|
||||||
if (!$repository_api->supportsLocalBranchMerge()) {
|
if (!$repository_api->supportsLocalBranchMerge()) {
|
||||||
$name = $repository_api->getSourceControlSystemName();
|
$name = $repository_api->getSourceControlSystemName();
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
|
@ -157,7 +161,7 @@ EOTEXT
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSupportedRevisionControlSystems() {
|
protected function getSupportedRevisionControlSystems() {
|
||||||
return array('git', 'hg');
|
return array('hg');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue