Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lands a branch by rebasing, merging and amending it.
|
|
|
|
*/
|
2014-07-21 23:49:15 +02:00
|
|
|
final class ArcanistLandWorkflow extends ArcanistWorkflow {
|
2014-07-09 01:12:13 +02:00
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
private $isGit;
|
2012-12-08 03:13:32 +01:00
|
|
|
private $isGitSvn;
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
private $isHg;
|
2013-01-25 20:52:14 +01:00
|
|
|
private $isHgSvn;
|
2012-12-03 22:03:13 +01:00
|
|
|
|
|
|
|
private $oldBranch;
|
|
|
|
private $branch;
|
|
|
|
private $onto;
|
|
|
|
private $ontoRemoteBranch;
|
|
|
|
private $remote;
|
|
|
|
private $useSquash;
|
|
|
|
private $keepBranch;
|
2013-03-01 23:04:05 +01:00
|
|
|
private $branchType;
|
|
|
|
private $ontoType;
|
2013-03-29 18:08:23 +01:00
|
|
|
private $preview;
|
2012-12-03 22:03:13 +01:00
|
|
|
|
|
|
|
private $revision;
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
private $messageFile;
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2015-05-14 19:58:22 +02:00
|
|
|
const REFTYPE_BRANCH = 'branch';
|
|
|
|
const REFTYPE_BOOKMARK = 'bookmark';
|
|
|
|
|
2014-03-11 23:21:46 +01:00
|
|
|
public function getRevisionDict() {
|
|
|
|
return $this->revision;
|
|
|
|
}
|
|
|
|
|
Make Arcanist workflow names explicit
Summary:
Currently, adding a new workflow requires you to override ArcanistConfiguration, which is messy. Instead, just load everything that extends ArcanistBaseWorkflow.
Remove all the rules tying workflow names to class names through arcane incantations.
This has a very small performance cost in that we need to load every Workflow class every time now, but we don't hit __init__ and such anymore and it was pretty negligible on my machine (98ms vs 104ms or something).
Test Plan: Ran "arc help", "arc which", "arc diff", etc.
Reviewers: edward, vrana, btrahan
Reviewed By: edward
CC: aran, zeeg
Differential Revision: https://secure.phabricator.com/D3691
2012-10-17 17:35:03 +02:00
|
|
|
public function getWorkflowName() {
|
|
|
|
return 'land';
|
|
|
|
}
|
|
|
|
|
2012-03-05 19:02:37 +01:00
|
|
|
public function getCommandSynopses() {
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
return phutil_console_format(<<<EOTEXT
|
2015-10-28 16:28:46 +01:00
|
|
|
**land** [__options__] [__ref__]
|
2012-03-05 19:02:37 +01:00
|
|
|
EOTEXT
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommandHelp() {
|
|
|
|
return phutil_console_format(<<<EOTEXT
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
Supports: git, hg
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2015-10-28 16:28:46 +01:00
|
|
|
Publish an accepted revision after review. This command is the last
|
|
|
|
step in the standard Differential pre-publish code review workflow.
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2015-10-28 16:28:46 +01:00
|
|
|
This command merges and pushes changes associated with an accepted
|
|
|
|
revision that are currently sitting in __ref__, which is usually the
|
|
|
|
name of a local branch. Without __ref__, the current working copy
|
|
|
|
state will be used.
|
|
|
|
|
|
|
|
Under Git: branches, tags, and arbitrary commits (detached HEADs)
|
|
|
|
may be landed.
|
|
|
|
|
|
|
|
Under Mercurial: branches and bookmarks may be landed, but only
|
|
|
|
onto a target of the same type. See T3855.
|
|
|
|
|
|
|
|
The workflow selects a target branch to land onto and a remote where
|
|
|
|
the change will be pushed to.
|
|
|
|
|
|
|
|
A target branch is selected by examining these sources in order:
|
|
|
|
|
|
|
|
- the **--onto** flag;
|
|
|
|
- the upstream of the current branch, recursively (Git only);
|
|
|
|
- the __arc.land.onto.default__ configuration setting;
|
|
|
|
- or by falling back to a standard default:
|
|
|
|
- "master" in Git;
|
|
|
|
- "default" in Mercurial.
|
|
|
|
|
|
|
|
A remote is selected by examining these sources in order:
|
|
|
|
|
|
|
|
- the **--remote** flag;
|
|
|
|
- the upstream of the current branch, recursively (Git only);
|
|
|
|
- or by falling back to a standard default:
|
|
|
|
- "origin" in Git;
|
|
|
|
- the default remote in Mercurial.
|
|
|
|
|
|
|
|
After selecting a target branch and a remote, the commits which will
|
|
|
|
be landed are printed.
|
|
|
|
|
|
|
|
With **--preview**, execution stops here, before the change is
|
|
|
|
merged.
|
|
|
|
|
2015-12-12 18:38:32 +01:00
|
|
|
The change is merged with the changes in the target branch,
|
|
|
|
following these rules:
|
2015-10-28 16:28:46 +01:00
|
|
|
|
2015-12-12 18:38:32 +01:00
|
|
|
In repositories with mutable history or with **--squash**, this will
|
|
|
|
perform a squash merge (the entire branch will be represented as one
|
|
|
|
commit after the merge).
|
2015-10-28 16:28:46 +01:00
|
|
|
|
2015-12-12 18:38:32 +01:00
|
|
|
In repositories with immutable history or with **--merge**, this will
|
|
|
|
perform a strict merge (a merge commit will always be created, and
|
|
|
|
local commits will be preserved).
|
2015-10-28 16:28:46 +01:00
|
|
|
|
|
|
|
The resulting commit will be given an up-to-date commit message
|
|
|
|
describing the final state of the revision in Differential.
|
2015-12-12 18:38:32 +01:00
|
|
|
|
|
|
|
In Git, the merge occurs in a detached HEAD. The local branch
|
|
|
|
reference (if one exists) is not updated yet.
|
2015-10-28 16:28:46 +01:00
|
|
|
|
|
|
|
With **--hold**, execution stops here, before the change is pushed.
|
|
|
|
|
|
|
|
The change is pushed into the remote.
|
|
|
|
|
|
|
|
Consulting mystical sources of power, the workflow makes a guess
|
|
|
|
about what state you wanted to end up in after the process finishes
|
|
|
|
and the working copy is put into that state.
|
|
|
|
|
|
|
|
The branch which was landed is deleted, unless the **--keep-branch**
|
|
|
|
flag was passed or the landing branch is the same as the target
|
|
|
|
branch.
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
EOTEXT
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function requiresWorkingCopy() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function requiresConduit() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function requiresAuthentication() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function requiresRepositoryAPI() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getArguments() {
|
|
|
|
return array(
|
|
|
|
'onto' => array(
|
|
|
|
'param' => 'master',
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
"Land feature branch onto a branch other than the default ".
|
|
|
|
"('master' in git, 'default' in hg). You can change the default ".
|
2015-05-13 10:05:15 +02:00
|
|
|
"by setting '%s' with `%s` or for the entire project in %s.",
|
|
|
|
'arc.land.onto.default',
|
|
|
|
'arc set-config',
|
|
|
|
'.arcconfig'),
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
),
|
|
|
|
'hold' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
'Prepare the change to be pushed, but do not actually push it.'),
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
),
|
|
|
|
'keep-branch' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
'Keep the feature branch after pushing changes to the '.
|
|
|
|
'remote (by default, it is deleted).'),
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
),
|
|
|
|
'remote' => array(
|
|
|
|
'param' => 'origin',
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
"Push to a remote other than the default ('origin' in git)."),
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
),
|
2012-02-20 21:51:14 +01:00
|
|
|
'merge' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
'Perform a %s merge, not a %s merge. If the project '.
|
2014-07-09 01:12:13 +02:00
|
|
|
'is marked as having an immutable history, this is the default '.
|
2015-05-13 10:05:15 +02:00
|
|
|
'behavior.',
|
|
|
|
'--no-ff',
|
|
|
|
'--squash'),
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
'supports' => array(
|
|
|
|
'git',
|
|
|
|
),
|
|
|
|
'nosupport' => array(
|
2015-05-13 10:05:15 +02:00
|
|
|
'hg' => pht(
|
|
|
|
'Use the %s strategy when landing in mercurial.',
|
|
|
|
'--squash'),
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
),
|
2012-02-20 21:51:14 +01:00
|
|
|
),
|
2012-03-23 02:20:22 +01:00
|
|
|
'squash' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
'Perform a %s merge, not a %s merge. If the project is '.
|
|
|
|
'marked as having a mutable history, this is the default behavior.',
|
|
|
|
'--squash',
|
|
|
|
'--no-ff'),
|
2012-03-23 02:20:22 +01:00
|
|
|
'conflicts' => array(
|
2015-05-13 10:05:15 +02:00
|
|
|
'merge' => pht(
|
|
|
|
'%s and %s are conflicting merge strategies.',
|
|
|
|
'--merge',
|
|
|
|
'--squash'),
|
2012-03-23 02:20:22 +01:00
|
|
|
),
|
|
|
|
),
|
2012-05-10 21:14:53 +02:00
|
|
|
'delete-remote' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
'Delete the feature branch in the remote after landing it.'),
|
2012-05-10 21:14:53 +02:00
|
|
|
'conflicts' => array(
|
|
|
|
'keep-branch' => true,
|
|
|
|
),
|
2013-04-14 20:48:22 +02:00
|
|
|
'supports' => array(
|
2017-06-09 15:52:18 +02:00
|
|
|
'hg',
|
Add an experimental "--mergeup" flag to use a less volatile merge strategy in "arc land"
Summary:
See chatlog from https://secure.phabricator.com/chatlog/channel/%23phabricator/?at=37257
Basically, the install's developers sometimes use "git merge master" instead of "git rebase master" to pull changes from master into their branch. When we run "git rebase master" at the end, this creates a lot of conflicts.
Instead, optionally run "git merge master". This should be equivalent in our case (where we always rebase) and much better in their case (where they sometimes merge).
We're both going to use it for a bit and see if it creates problems. If it improves the "sometimes-merge" workflow without affecting the "always rebase" workflow, we can make it a default. If it improves theirs but damages ours, we can keep it a flag/option. If it's just terrible, we can figure out something else.
Test Plan:
Ran `arc land --mergeup --trace <feature> --keep-branch --hold`, see P624 for output. Observed merge update strategy and general success.
Also verified the conflict:
$ arc land --mergeup --merge
Usage Exception: Arguments '--mergeup' and '--merge' are mutually exclusive: The --merge strategy does not update the feature branch.
Reviewers: btrahan, vrana, DurhamGoode
Reviewed By: btrahan
CC: aran, keir
Differential Revision: https://secure.phabricator.com/D4080
2012-12-13 23:11:52 +01:00
|
|
|
),
|
|
|
|
),
|
2012-03-03 01:47:05 +01:00
|
|
|
'revision' => array(
|
|
|
|
'param' => 'id',
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
'Use the message from a specific revision, rather than '.
|
|
|
|
'inferring the revision based on branch content.'),
|
2012-03-03 01:47:05 +01:00
|
|
|
),
|
2013-03-29 18:08:23 +01:00
|
|
|
'preview' => array(
|
2014-07-09 01:12:13 +02:00
|
|
|
'help' => pht(
|
|
|
|
'Prints the commits that would be landed. Does not '.
|
|
|
|
'actually modify or land the commits.'),
|
2013-03-29 18:08:23 +01:00
|
|
|
),
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
'*' => 'branch',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function run() {
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->readArguments();
|
2015-10-28 01:49:01 +01:00
|
|
|
|
|
|
|
$engine = null;
|
|
|
|
if ($this->isGit && !$this->isGitSvn) {
|
|
|
|
$engine = new ArcanistGitLandEngine();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($engine) {
|
2015-10-28 16:28:46 +01:00
|
|
|
$this->readEngineArguments();
|
2015-10-28 01:49:01 +01:00
|
|
|
$this->requireCleanWorkingCopy();
|
|
|
|
|
|
|
|
$should_hold = $this->getArgument('hold');
|
|
|
|
|
|
|
|
$engine
|
|
|
|
->setWorkflow($this)
|
|
|
|
->setRepositoryAPI($this->getRepositoryAPI())
|
|
|
|
->setSourceRef($this->branch)
|
|
|
|
->setTargetRemote($this->remote)
|
|
|
|
->setTargetOnto($this->onto)
|
|
|
|
->setShouldHold($should_hold)
|
|
|
|
->setShouldKeep($this->keepBranch)
|
|
|
|
->setShouldSquash($this->useSquash)
|
|
|
|
->setShouldPreview($this->preview)
|
|
|
|
->setBuildMessageCallback(array($this, 'buildEngineMessage'));
|
|
|
|
|
|
|
|
$engine->execute();
|
|
|
|
|
2015-10-28 16:28:46 +01:00
|
|
|
if (!$should_hold && !$this->preview) {
|
2015-10-28 01:49:01 +01:00
|
|
|
$this->didPush();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->validate();
|
2012-12-21 23:18:07 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
$this->pullFromRemote();
|
|
|
|
} catch (Exception $ex) {
|
|
|
|
$this->restoreBranch();
|
|
|
|
throw $ex;
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
|
2013-03-29 18:08:23 +01:00
|
|
|
$this->printPendingCommits();
|
|
|
|
if ($this->preview) {
|
|
|
|
$this->restoreBranch();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-12-04 01:31:45 +01:00
|
|
|
$this->checkoutBranch();
|
|
|
|
$this->findRevision();
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
if ($this->useSquash) {
|
|
|
|
$this->rebase();
|
2014-05-23 20:00:07 +02:00
|
|
|
$this->squash();
|
2012-12-03 22:03:13 +01:00
|
|
|
} else {
|
|
|
|
$this->merge();
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->push();
|
2012-12-21 23:18:07 +01:00
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
if (!$this->keepBranch) {
|
|
|
|
$this->cleanupBranch();
|
|
|
|
}
|
|
|
|
|
2013-02-07 03:44:55 +01:00
|
|
|
if ($this->oldBranch != $this->onto) {
|
|
|
|
// If we were on some branch A and the user ran "arc land B",
|
|
|
|
// switch back to A.
|
|
|
|
if ($this->keepBranch || $this->oldBranch != $this->branch) {
|
|
|
|
$this->restoreBranch();
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht('Done.'), "\n";
|
2012-12-03 22:03:13 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-07-29 01:22:04 +02:00
|
|
|
private function getUpstreamMatching($branch, $pattern) {
|
|
|
|
if ($this->isGit) {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
list($err, $fullname) = $repository_api->execManualLocal(
|
|
|
|
'rev-parse --symbolic-full-name %s@{upstream}',
|
|
|
|
$branch);
|
|
|
|
if (!$err) {
|
|
|
|
$matches = null;
|
|
|
|
if (preg_match($pattern, $fullname, $matches)) {
|
|
|
|
return last($matches);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-10-28 16:28:46 +01:00
|
|
|
private function readEngineArguments() {
|
|
|
|
// NOTE: This is hard-coded for Git right now.
|
|
|
|
// TODO: Clean this up and move it into LandEngines.
|
|
|
|
|
|
|
|
$onto = $this->getEngineOnto();
|
|
|
|
$remote = $this->getEngineRemote();
|
|
|
|
|
|
|
|
// This just overwrites work we did earlier, but it has to be up in this
|
|
|
|
// class for now because other parts of the workflow still depend on it.
|
|
|
|
$this->onto = $onto;
|
|
|
|
$this->remote = $remote;
|
|
|
|
$this->ontoRemoteBranch = $this->remote.'/'.$onto;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getEngineOnto() {
|
|
|
|
$onto = $this->getArgument('onto');
|
|
|
|
if ($onto !== null) {
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('TARGET'),
|
|
|
|
pht(
|
|
|
|
'Landing onto "%s", selected by the --onto flag.',
|
|
|
|
$onto));
|
|
|
|
return $onto;
|
|
|
|
}
|
|
|
|
|
|
|
|
$api = $this->getRepositoryAPI();
|
|
|
|
$path = $api->getPathToUpstream($this->branch);
|
|
|
|
|
2015-10-28 19:30:57 +01:00
|
|
|
if ($path->getLength()) {
|
|
|
|
$cycle = $path->getCycle();
|
|
|
|
if ($cycle) {
|
2015-10-28 16:28:46 +01:00
|
|
|
$this->writeWarn(
|
|
|
|
pht('LOCAL CYCLE'),
|
|
|
|
pht(
|
|
|
|
'Local branch tracks an upstream, but following it leads to a '.
|
|
|
|
'local cycle; ignoring branch upstream.'));
|
|
|
|
|
|
|
|
echo tsprintf(
|
|
|
|
"\n %s\n\n",
|
2015-10-28 19:30:57 +01:00
|
|
|
implode(' -> ', $cycle));
|
2015-10-28 16:28:46 +01:00
|
|
|
|
|
|
|
} else {
|
2015-10-28 19:30:57 +01:00
|
|
|
if ($path->isConnectedToRemote()) {
|
|
|
|
$onto = $path->getRemoteBranchName();
|
2015-10-28 16:28:46 +01:00
|
|
|
$this->writeInfo(
|
|
|
|
pht('TARGET'),
|
|
|
|
pht(
|
|
|
|
'Landing onto "%s", selected by following tracking branches '.
|
|
|
|
'upstream to the closest remote.',
|
|
|
|
$onto));
|
|
|
|
return $onto;
|
|
|
|
} else {
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('NO PATH TO UPSTREAM'),
|
|
|
|
pht(
|
|
|
|
'Local branch tracks an upstream, but there is no path '.
|
|
|
|
'to a remote; ignoring branch upstream.'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$config_key = 'arc.land.onto.default';
|
|
|
|
$onto = $this->getConfigFromAnySource($config_key);
|
|
|
|
if ($onto !== null) {
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('TARGET'),
|
|
|
|
pht(
|
|
|
|
'Landing onto "%s", selected by "%s" configuration.',
|
|
|
|
$onto,
|
|
|
|
$config_key));
|
|
|
|
return $onto;
|
|
|
|
}
|
|
|
|
|
|
|
|
$onto = 'master';
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('TARGET'),
|
|
|
|
pht(
|
|
|
|
'Landing onto "%s", the default target under git.',
|
|
|
|
$onto));
|
|
|
|
return $onto;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getEngineRemote() {
|
|
|
|
$remote = $this->getArgument('remote');
|
|
|
|
if ($remote !== null) {
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('REMOTE'),
|
|
|
|
pht(
|
|
|
|
'Using remote "%s", selected by the --remote flag.',
|
|
|
|
$remote));
|
|
|
|
return $remote;
|
|
|
|
}
|
|
|
|
|
|
|
|
$api = $this->getRepositoryAPI();
|
|
|
|
$path = $api->getPathToUpstream($this->branch);
|
|
|
|
|
2015-10-28 19:30:57 +01:00
|
|
|
$remote = $path->getRemoteRemoteName();
|
|
|
|
if ($remote !== null) {
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('REMOTE'),
|
|
|
|
pht(
|
|
|
|
'Using remote "%s", selected by following tracking branches '.
|
|
|
|
'upstream to the closest remote.',
|
|
|
|
$remote));
|
|
|
|
return $remote;
|
2015-10-28 16:28:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$remote = 'origin';
|
|
|
|
$this->writeInfo(
|
|
|
|
pht('REMOTE'),
|
|
|
|
pht(
|
|
|
|
'Using remote "%s", the default remote under git.',
|
|
|
|
$remote));
|
|
|
|
return $remote;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
private function readArguments() {
|
2012-04-23 23:09:29 +02:00
|
|
|
$repository_api = $this->getRepositoryAPI();
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->isGit = $repository_api instanceof ArcanistGitAPI;
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->isHg = $repository_api instanceof ArcanistMercurialAPI;
|
2012-12-03 22:03:13 +01:00
|
|
|
|
2012-12-08 03:13:32 +01:00
|
|
|
if ($this->isGit) {
|
|
|
|
$repository = $this->loadProjectRepository();
|
|
|
|
$this->isGitSvn = (idx($repository, 'vcs') == 'svn');
|
|
|
|
}
|
|
|
|
|
2013-01-25 20:52:14 +01:00
|
|
|
if ($this->isHg) {
|
2013-02-19 22:36:02 +01:00
|
|
|
$this->isHgSvn = $repository_api->isHgSubversionRepo();
|
2013-01-25 20:52:14 +01:00
|
|
|
}
|
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
$branch = $this->getArgument('branch');
|
2012-04-23 23:09:29 +02:00
|
|
|
if (empty($branch)) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$branch = $this->getBranchOrBookmark();
|
2017-10-04 17:22:10 +02:00
|
|
|
if ($branch !== null) {
|
2013-03-01 23:04:05 +01:00
|
|
|
$this->branchType = $this->getBranchType($branch);
|
2015-10-28 16:28:46 +01:00
|
|
|
|
|
|
|
// TODO: This message is misleading when landing a detached head or
|
|
|
|
// a tag in Git.
|
|
|
|
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht("Landing current %s '%s'.", $this->branchType, $branch), "\n";
|
2012-04-23 23:09:29 +02:00
|
|
|
$branch = array($branch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
if (count($branch) !== 1) {
|
|
|
|
throw new ArcanistUsageException(
|
2014-04-09 21:35:31 +02:00
|
|
|
pht('Specify exactly one branch or bookmark to land changes from.'));
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->branch = head($branch);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->keepBranch = $this->getArgument('keep-branch');
|
2013-04-14 20:48:22 +02:00
|
|
|
|
2013-03-29 18:08:23 +01:00
|
|
|
$this->preview = $this->getArgument('preview');
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2013-03-01 23:04:05 +01:00
|
|
|
if (!$this->branchType) {
|
|
|
|
$this->branchType = $this->getBranchType($this->branch);
|
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$onto_default = $this->isGit ? 'master' : 'default';
|
2012-03-23 02:20:22 +01:00
|
|
|
$onto_default = nonempty(
|
2013-10-19 01:10:06 +02:00
|
|
|
$this->getConfigFromAnySource('arc.land.onto.default'),
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$onto_default);
|
2014-07-29 01:22:04 +02:00
|
|
|
$onto_default = coalesce(
|
|
|
|
$this->getUpstreamMatching($this->branch, '/^refs\/heads\/(.+)$/'),
|
|
|
|
$onto_default);
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->onto = $this->getArgument('onto', $onto_default);
|
2013-03-01 23:04:05 +01:00
|
|
|
$this->ontoType = $this->getBranchType($this->onto);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
|
|
|
|
$remote_default = $this->isGit ? 'origin' : '';
|
2014-07-29 01:22:04 +02:00
|
|
|
$remote_default = coalesce(
|
|
|
|
$this->getUpstreamMatching($this->onto, '/^refs\/remotes\/(.+?)\//'),
|
|
|
|
$remote_default);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->remote = $this->getArgument('remote', $remote_default);
|
2012-12-03 22:03:13 +01:00
|
|
|
|
|
|
|
if ($this->getArgument('merge')) {
|
|
|
|
$this->useSquash = false;
|
|
|
|
} else if ($this->getArgument('squash')) {
|
|
|
|
$this->useSquash = true;
|
|
|
|
} else {
|
|
|
|
$this->useSquash = !$this->isHistoryImmutable();
|
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->ontoRemoteBranch = $this->onto;
|
2012-12-08 03:13:32 +01:00
|
|
|
if ($this->isGitSvn) {
|
|
|
|
$this->ontoRemoteBranch = 'trunk';
|
|
|
|
} else if ($this->isGit) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->ontoRemoteBranch = $this->remote.'/'.$this->onto;
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->oldBranch = $this->getBranchOrBookmark();
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
2012-03-23 02:20:22 +01:00
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
private function validate() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
2012-05-23 20:40:20 +02:00
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
if ($this->onto == $this->branch) {
|
2014-04-09 21:35:31 +02:00
|
|
|
$message = pht(
|
|
|
|
"You can not land a %s onto itself -- you are trying ".
|
|
|
|
"to land '%s' onto '%s'. For more information on how to push ".
|
|
|
|
"changes, see 'Pushing and Closing Revisions' in 'Arcanist User ".
|
|
|
|
"Guide: arc diff' in the documentation.",
|
|
|
|
$this->branchType,
|
|
|
|
$this->branch,
|
|
|
|
$this->onto);
|
2012-12-03 22:03:13 +01:00
|
|
|
if (!$this->isHistoryImmutable()) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$message .= ' '.pht("You may be able to '%s' instead.", 'arc amend');
|
2012-05-23 20:40:20 +02:00
|
|
|
}
|
|
|
|
throw new ArcanistUsageException($message);
|
2012-05-10 21:14:53 +02:00
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($this->isHg) {
|
|
|
|
if ($this->useSquash) {
|
2013-02-19 22:36:02 +01:00
|
|
|
if (!$repository_api->supportsRebase()) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
throw new ArcanistUsageException(
|
2014-07-09 01:12:13 +02:00
|
|
|
pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
'You must enable the rebase extension to use the %s strategy.',
|
|
|
|
'--squash'));
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2013-03-01 23:04:05 +01:00
|
|
|
if ($this->branchType != $this->ontoType) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
2014-05-23 22:53:05 +02:00
|
|
|
'Source %s is a %s but destination %s is a %s. When landing a '.
|
2015-05-13 10:05:15 +02:00
|
|
|
'%s, the destination must also be a %s. Use %s to specify a %s, '.
|
|
|
|
'or set %s in %s.',
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->branch,
|
|
|
|
$this->branchType,
|
|
|
|
$this->onto,
|
|
|
|
$this->ontoType,
|
|
|
|
$this->branchType,
|
|
|
|
$this->branchType,
|
2015-05-13 10:05:15 +02:00
|
|
|
'--onto',
|
|
|
|
$this->branchType,
|
|
|
|
'arc.land.onto.default',
|
|
|
|
'.arcconfig'));
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->isGit) {
|
|
|
|
list($err) = $repository_api->execManualLocal(
|
|
|
|
'rev-parse --verify %s',
|
|
|
|
$this->branch);
|
|
|
|
|
|
|
|
if ($err) {
|
|
|
|
throw new ArcanistUsageException(
|
2014-04-09 21:35:31 +02:00
|
|
|
pht("Branch '%s' does not exist.", $this->branch));
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->requireCleanWorkingCopy();
|
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2012-12-04 01:31:45 +01:00
|
|
|
private function checkoutBranch() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
2013-02-19 22:36:02 +01:00
|
|
|
if ($this->getBranchOrBookmark() != $this->branch) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('checkout %s', $this->branch);
|
2013-02-19 22:36:02 +01:00
|
|
|
}
|
2012-12-04 01:31:45 +01:00
|
|
|
|
2015-05-14 19:58:22 +02:00
|
|
|
switch ($this->branchType) {
|
|
|
|
case self::REFTYPE_BOOKMARK:
|
|
|
|
$message = pht(
|
|
|
|
'Switched to bookmark **%s**. Identifying and merging...',
|
|
|
|
$this->branch);
|
|
|
|
break;
|
|
|
|
case self::REFTYPE_BRANCH:
|
|
|
|
default:
|
|
|
|
$message = pht(
|
|
|
|
'Switched to branch **%s**. Identifying and merging...',
|
|
|
|
$this->branch);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo phutil_console_format($message."\n");
|
2012-12-04 01:31:45 +01:00
|
|
|
}
|
|
|
|
|
2013-03-29 18:08:23 +01:00
|
|
|
private function printPendingCommits() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
|
|
|
if ($repository_api instanceof ArcanistGitAPI) {
|
|
|
|
list($out) = $repository_api->execxLocal(
|
2013-04-22 05:54:51 +02:00
|
|
|
'log --oneline %s %s --',
|
2013-03-29 18:08:23 +01:00
|
|
|
$this->branch,
|
2013-04-06 08:17:40 +02:00
|
|
|
'^'.$this->onto);
|
2013-03-29 18:08:23 +01:00
|
|
|
} else if ($repository_api instanceof ArcanistMercurialAPI) {
|
|
|
|
$common_ancestor = $repository_api->getCanonicalRevisionName(
|
|
|
|
hgsprintf('ancestor(%s,%s)',
|
|
|
|
$this->onto,
|
|
|
|
$this->branch));
|
|
|
|
|
|
|
|
$branch_range = hgsprintf(
|
|
|
|
'reverse((%s::%s) - %s)',
|
|
|
|
$common_ancestor,
|
|
|
|
$this->branch,
|
|
|
|
$common_ancestor);
|
|
|
|
|
|
|
|
list($out) = $repository_api->execxLocal(
|
|
|
|
'log -r %s --template %s',
|
|
|
|
$branch_range,
|
|
|
|
'{node|short} {desc|firstline}\n');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!trim($out)) {
|
|
|
|
$this->restoreBranch();
|
|
|
|
throw new ArcanistUsageException(
|
2015-05-13 10:05:15 +02:00
|
|
|
pht('No commits to land from %s.', $this->branch));
|
2013-03-29 18:08:23 +01:00
|
|
|
}
|
|
|
|
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht("The following commit(s) will be landed:\n\n%s", $out), "\n";
|
2013-03-29 18:08:23 +01:00
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
private function findRevision() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2012-12-17 21:54:08 +01:00
|
|
|
$this->parseBaseCommitArgument(array($this->ontoRemoteBranch));
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2012-03-03 01:47:05 +01:00
|
|
|
$revision_id = $this->getArgument('revision');
|
|
|
|
if ($revision_id) {
|
|
|
|
$revision_id = $this->normalizeRevisionID($revision_id);
|
|
|
|
$revisions = $this->getConduit()->callMethodSynchronous(
|
|
|
|
'differential.query',
|
|
|
|
array(
|
|
|
|
'ids' => array($revision_id),
|
|
|
|
));
|
|
|
|
if (!$revisions) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
|
|
|
"No such revision '%s'!",
|
|
|
|
"D{$revision_id}"));
|
2012-03-03 01:47:05 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$revisions = $repository_api->loadWorkingCopyDifferentialRevisions(
|
|
|
|
$this->getConduit(),
|
2014-04-07 20:44:14 +02:00
|
|
|
array());
|
2012-03-03 01:47:05 +01:00
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
|
|
|
if (!count($revisions)) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
2014-05-20 20:34:22 +02:00
|
|
|
"arc can not identify which revision exists on %s '%s'. Update the ".
|
|
|
|
"revision with recent changes to synchronize the %s name and hashes, ".
|
2015-05-13 10:05:15 +02:00
|
|
|
"or use '%s' to amend the commit message at HEAD, or use ".
|
|
|
|
"'%s' to select a revision explicitly.",
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->branchType,
|
|
|
|
$this->branch,
|
2015-05-13 10:05:15 +02:00
|
|
|
$this->branchType,
|
|
|
|
'arc amend',
|
|
|
|
'--revision <id>'));
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
} else if (count($revisions) > 1) {
|
2015-08-20 13:19:22 +02:00
|
|
|
switch ($this->branchType) {
|
|
|
|
case self::REFTYPE_BOOKMARK:
|
|
|
|
$message = pht(
|
|
|
|
"There are multiple revisions on feature bookmark '%s' which are ".
|
|
|
|
"not present on '%s':\n\n".
|
|
|
|
"%s\n".
|
|
|
|
'Separate these revisions onto different bookmarks, or use '.
|
|
|
|
'--revision <id> to use the commit message from <id> '.
|
|
|
|
'and land them all.',
|
|
|
|
$this->branch,
|
|
|
|
$this->onto,
|
|
|
|
$this->renderRevisionList($revisions));
|
|
|
|
break;
|
|
|
|
case self::REFTYPE_BRANCH:
|
|
|
|
default:
|
|
|
|
$message = pht(
|
|
|
|
"There are multiple revisions on feature branch '%s' which are ".
|
|
|
|
"not present on '%s':\n\n".
|
|
|
|
"%s\n".
|
|
|
|
'Separate these revisions onto different branches, or use '.
|
|
|
|
'--revision <id> to use the commit message from <id> '.
|
|
|
|
'and land them all.',
|
|
|
|
$this->branch,
|
|
|
|
$this->onto,
|
|
|
|
$this->renderRevisionList($revisions));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
throw new ArcanistUsageException($message);
|
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->revision = head($revisions);
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
$rev_status = $this->revision['status'];
|
|
|
|
$rev_id = $this->revision['id'];
|
|
|
|
$rev_title = $this->revision['title'];
|
2013-03-07 17:55:34 +01:00
|
|
|
$rev_auxiliary = idx($this->revision, 'auxiliary', array());
|
2012-12-03 22:03:13 +01:00
|
|
|
|
2014-04-07 20:44:14 +02:00
|
|
|
if ($this->revision['authorPHID'] != $this->getUserPHID()) {
|
|
|
|
$other_author = $this->getConduit()->callMethodSynchronous(
|
|
|
|
'user.query',
|
|
|
|
array(
|
|
|
|
'phids' => array($this->revision['authorPHID']),
|
|
|
|
));
|
|
|
|
$other_author = ipull($other_author, 'userName', 'phid');
|
|
|
|
$other_author = $other_author[$this->revision['authorPHID']];
|
2014-04-09 21:35:31 +02:00
|
|
|
$ok = phutil_console_confirm(pht(
|
|
|
|
"This %s has revision '%s' but you are not the author. Land this ".
|
|
|
|
"revision by %s?",
|
|
|
|
$this->branchType,
|
|
|
|
"D{$rev_id}: {$rev_title}",
|
|
|
|
$other_author));
|
2014-04-07 20:44:14 +02:00
|
|
|
if (!$ok) {
|
|
|
|
throw new ArcanistUserAbortException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
if ($rev_status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
2014-04-09 21:35:31 +02:00
|
|
|
$ok = phutil_console_confirm(pht(
|
2014-05-07 18:15:14 +02:00
|
|
|
"Revision '%s' has not been accepted. Continue anyway?",
|
2014-04-09 21:35:31 +02:00
|
|
|
"D{$rev_id}: {$rev_title}"));
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
if (!$ok) {
|
|
|
|
throw new ArcanistUserAbortException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-07 17:55:34 +01:00
|
|
|
if ($rev_auxiliary) {
|
|
|
|
$phids = idx($rev_auxiliary, 'phabricator:depends-on', array());
|
2013-03-08 02:21:37 +01:00
|
|
|
if ($phids) {
|
|
|
|
$dep_on_revs = $this->getConduit()->callMethodSynchronous(
|
|
|
|
'differential.query',
|
|
|
|
array(
|
|
|
|
'phids' => $phids,
|
|
|
|
'status' => 'status-open',
|
|
|
|
));
|
|
|
|
|
|
|
|
$open_dep_revs = array();
|
|
|
|
foreach ($dep_on_revs as $dep_on_rev) {
|
|
|
|
$dep_on_rev_id = $dep_on_rev['id'];
|
|
|
|
$dep_on_rev_title = $dep_on_rev['title'];
|
|
|
|
$dep_on_rev_status = $dep_on_rev['status'];
|
|
|
|
$open_dep_revs[$dep_on_rev_id] = $dep_on_rev_title;
|
2013-03-07 17:55:34 +01:00
|
|
|
}
|
|
|
|
|
2013-03-08 02:21:37 +01:00
|
|
|
if (!empty($open_dep_revs)) {
|
|
|
|
$open_revs = array();
|
|
|
|
foreach ($open_dep_revs as $id => $title) {
|
2014-05-23 22:53:05 +02:00
|
|
|
$open_revs[] = ' - D'.$id.': '.$title;
|
2013-03-08 02:21:37 +01:00
|
|
|
}
|
|
|
|
$open_revs = implode("\n", $open_revs);
|
|
|
|
|
2015-05-13 10:05:15 +02:00
|
|
|
echo pht(
|
|
|
|
"Revision '%s' depends on open revisions:\n\n%s",
|
|
|
|
"D{$rev_id}: {$rev_title}",
|
|
|
|
$open_revs);
|
2013-03-08 02:21:37 +01:00
|
|
|
|
2014-05-23 22:53:05 +02:00
|
|
|
$ok = phutil_console_confirm(pht('Continue anyway?'));
|
2013-03-08 02:21:37 +01:00
|
|
|
if (!$ok) {
|
|
|
|
throw new ArcanistUserAbortException();
|
|
|
|
}
|
2013-03-07 17:55:34 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$message = $this->getConduit()->callMethodSynchronous(
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
'differential.getcommitmessage',
|
|
|
|
array(
|
2012-12-03 22:03:13 +01:00
|
|
|
'revision_id' => $rev_id,
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
));
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->messageFile = new TempFile();
|
|
|
|
Filesystem::writeFile($this->messageFile, $message);
|
|
|
|
|
2015-05-13 10:05:15 +02:00
|
|
|
echo pht(
|
|
|
|
"Landing revision '%s'...",
|
|
|
|
"D{$rev_id}: {$rev_title}")."\n";
|
2014-04-18 00:59:54 +02:00
|
|
|
|
|
|
|
$diff_phid = idx($this->revision, 'activeDiffPHID');
|
|
|
|
if ($diff_phid) {
|
|
|
|
$this->checkForBuildables($diff_phid);
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function pullFromRemote() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$local_ahead_of_remote = false;
|
|
|
|
if ($this->isGit) {
|
2013-02-19 22:36:02 +01:00
|
|
|
$repository_api->execxLocal('checkout %s', $this->onto);
|
|
|
|
|
2014-04-09 21:35:31 +02:00
|
|
|
echo phutil_console_format(pht(
|
2013-02-19 22:36:02 +01:00
|
|
|
"Switched to branch **%s**. Updating branch...\n",
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->onto));
|
2013-02-19 22:36:02 +01:00
|
|
|
|
2013-01-29 00:54:37 +01:00
|
|
|
try {
|
2013-01-31 02:57:06 +01:00
|
|
|
$repository_api->execxLocal('pull --ff-only --no-stat');
|
2013-01-29 00:54:37 +01:00
|
|
|
} catch (CommandException $ex) {
|
|
|
|
if (!$this->isGitSvn) {
|
|
|
|
throw $ex;
|
|
|
|
}
|
2014-04-09 21:35:31 +02:00
|
|
|
}
|
|
|
|
list($out) = $repository_api->execxLocal(
|
|
|
|
'log %s..%s',
|
|
|
|
$this->ontoRemoteBranch,
|
|
|
|
$this->onto);
|
|
|
|
if (strlen(trim($out))) {
|
|
|
|
$local_ahead_of_remote = true;
|
|
|
|
} else if ($this->isGitSvn) {
|
|
|
|
$repository_api->execxLocal('svn rebase');
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
2013-01-29 00:54:37 +01:00
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
} else if ($this->isHg) {
|
2015-05-13 10:05:15 +02:00
|
|
|
echo phutil_console_format(pht('Updating **%s**...', $this->onto)."\n");
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
try {
|
|
|
|
list($out, $err) = $repository_api->execxLocal('pull');
|
|
|
|
|
|
|
|
$divergedbookmark = $this->onto.'@'.$repository_api->getBranchName();
|
|
|
|
if (strpos($err, $divergedbookmark) !== false) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(phutil_console_format(pht(
|
|
|
|
"Local bookmark **%s** has diverged from the server's **%s** ".
|
|
|
|
"(now labeled **%s**). Please resolve this divergence and run ".
|
2015-05-13 10:05:15 +02:00
|
|
|
"'%s' again.",
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->onto,
|
|
|
|
$this->onto,
|
2015-05-13 10:05:15 +02:00
|
|
|
$divergedbookmark,
|
|
|
|
'arc land')));
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
}
|
|
|
|
} catch (CommandException $ex) {
|
|
|
|
$err = $ex->getError();
|
2017-02-18 10:24:19 +01:00
|
|
|
$stdout = $ex->getStdout();
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
|
|
|
|
// Copied from: PhabricatorRepositoryPullLocalDaemon.php
|
|
|
|
// NOTE: Between versions 2.1 and 2.1.1, Mercurial changed the
|
|
|
|
// behavior of "hg pull" to return 1 in case of a successful pull
|
|
|
|
// with no changes. This behavior has been reverted, but users who
|
|
|
|
// updated between Feb 1, 2012 and Mar 1, 2012 will have the
|
|
|
|
// erroring version. Do a dumb test against stdout to check for this
|
|
|
|
// possibility.
|
2014-05-29 18:15:33 +02:00
|
|
|
// See: https://github.com/phacility/phabricator/issues/101/
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
|
|
|
|
// NOTE: Mercurial has translated versions, which translate this error
|
|
|
|
// string. In a translated version, the string will be something else,
|
|
|
|
// like "aucun changement trouve". There didn't seem to be an easy way
|
|
|
|
// to handle this (there are hard ways but this is not a common
|
|
|
|
// problem and only creates log spam, not application failures).
|
|
|
|
// Assume English.
|
|
|
|
|
|
|
|
// TODO: Remove this once we're far enough in the future that
|
|
|
|
// deployment of 2.1 is exceedingly rare?
|
|
|
|
if ($err != 1 || !preg_match('/no changes found/', $stdout)) {
|
|
|
|
throw $ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-09 01:12:13 +02:00
|
|
|
// Pull succeeded. Now make sure master is not on an outgoing change
|
2013-02-19 22:36:02 +01:00
|
|
|
if ($repository_api->supportsPhases()) {
|
|
|
|
list($out) = $repository_api->execxLocal(
|
2014-05-23 22:53:05 +02:00
|
|
|
'log -r %s --template %s', $this->onto, '{phase}');
|
2013-02-19 22:36:02 +01:00
|
|
|
if ($out != 'public') {
|
|
|
|
$local_ahead_of_remote = true;
|
|
|
|
}
|
2013-01-16 21:15:46 +01:00
|
|
|
} else {
|
2013-02-19 22:36:02 +01:00
|
|
|
// execManual instead of execx because outgoing returns
|
|
|
|
// code 1 when there is nothing outgoing
|
|
|
|
list($err, $out) = $repository_api->execManualLocal(
|
|
|
|
'outgoing -r %s',
|
|
|
|
$this->onto);
|
|
|
|
|
|
|
|
// $err === 0 means something is outgoing
|
|
|
|
if ($err === 0) {
|
|
|
|
$local_ahead_of_remote = true;
|
|
|
|
}
|
|
|
|
}
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($local_ahead_of_remote) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
|
|
|
"Local %s '%s' is ahead of remote %s '%s', so landing a feature ".
|
|
|
|
"%s would push additional changes. Push or reset the changes in '%s' ".
|
2015-05-13 10:05:15 +02:00
|
|
|
"before running '%s'.",
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->ontoType,
|
|
|
|
$this->onto,
|
|
|
|
$this->ontoType,
|
|
|
|
$this->ontoRemoteBranch,
|
|
|
|
$this->ontoType,
|
2015-05-13 10:05:15 +02:00
|
|
|
$this->onto,
|
|
|
|
'arc land'));
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function rebase() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
2012-12-04 01:31:45 +01:00
|
|
|
chdir($repository_api->getPath());
|
2017-06-09 15:52:18 +02:00
|
|
|
if ($this->isHg) {
|
2013-01-22 23:29:00 +01:00
|
|
|
$onto_tip = $repository_api->getCanonicalRevisionName($this->onto);
|
|
|
|
$common_ancestor = $repository_api->getCanonicalRevisionName(
|
2015-05-13 10:05:15 +02:00
|
|
|
hgsprintf('ancestor(%s, %s)', $this->onto, $this->branch));
|
2013-01-22 23:29:00 +01:00
|
|
|
|
|
|
|
// Only rebase if the local branch is not at the tip of the onto branch.
|
|
|
|
if ($onto_tip != $common_ancestor) {
|
|
|
|
// keep branch here so later we can decide whether to remove it
|
|
|
|
$err = $repository_api->execPassthru(
|
|
|
|
'rebase -d %s --keepbranches',
|
|
|
|
$this->onto);
|
|
|
|
if ($err) {
|
2015-05-13 10:05:15 +02:00
|
|
|
echo phutil_console_format("%s\n", pht('Aborting rebase'));
|
|
|
|
$repository_api->execManualLocal('rebase --abort');
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
$this->restoreBranch();
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
"'%s' failed and the rebase was aborted. This is most ".
|
|
|
|
"likely due to conflicts. Manually rebase %s onto %s, resolve ".
|
|
|
|
"the conflicts, then run '%s' again.",
|
|
|
|
sprintf('hg rebase %s', $this->onto),
|
2014-04-09 21:35:31 +02:00
|
|
|
$this->branch,
|
2015-05-13 10:05:15 +02:00
|
|
|
$this->onto,
|
|
|
|
'arc land'));
|
2013-01-22 23:29:00 +01:00
|
|
|
}
|
Add an experimental "--mergeup" flag to use a less volatile merge strategy in "arc land"
Summary:
See chatlog from https://secure.phabricator.com/chatlog/channel/%23phabricator/?at=37257
Basically, the install's developers sometimes use "git merge master" instead of "git rebase master" to pull changes from master into their branch. When we run "git rebase master" at the end, this creates a lot of conflicts.
Instead, optionally run "git merge master". This should be equivalent in our case (where we always rebase) and much better in their case (where they sometimes merge).
We're both going to use it for a bit and see if it creates problems. If it improves the "sometimes-merge" workflow without affecting the "always rebase" workflow, we can make it a default. If it improves theirs but damages ours, we can keep it a flag/option. If it's just terrible, we can figure out something else.
Test Plan:
Ran `arc land --mergeup --trace <feature> --keep-branch --hold`, see P624 for output. Observed merge update strategy and general success.
Also verified the conflict:
$ arc land --mergeup --merge
Usage Exception: Arguments '--mergeup' and '--merge' are mutually exclusive: The --merge strategy does not update the feature branch.
Reviewers: btrahan, vrana, DurhamGoode
Reviewed By: btrahan
CC: aran, keir
Differential Revision: https://secure.phabricator.com/D4080
2012-12-13 23:11:52 +01:00
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
|
2012-12-17 21:54:08 +01:00
|
|
|
$repository_api->reloadWorkingCopy();
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function squash() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($this->isGit) {
|
2013-02-19 22:36:02 +01:00
|
|
|
$repository_api->execxLocal('checkout %s', $this->onto);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$repository_api->execxLocal(
|
2013-04-06 18:23:41 +02:00
|
|
|
'merge --no-stat --squash --ff-only %s',
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->branch);
|
2013-01-16 21:15:46 +01:00
|
|
|
} else if ($this->isHg) {
|
2012-12-06 04:31:25 +01:00
|
|
|
// The hg code is a little more complex than git's because we
|
|
|
|
// need to handle the case where the landing branch has child branches:
|
|
|
|
// -a--------b master
|
|
|
|
// \
|
|
|
|
// w--x mybranch
|
|
|
|
// \--y subbranch1
|
|
|
|
// \--z subbranch2
|
|
|
|
//
|
|
|
|
// arc land --branch mybranch --onto master :
|
|
|
|
// -a--b--wx master
|
|
|
|
// \--y subbranch1
|
|
|
|
// \--z subbranch2
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$branch_rev_id = $repository_api->getCanonicalRevisionName($this->branch);
|
|
|
|
|
2012-12-06 04:31:25 +01:00
|
|
|
// At this point $this->onto has been pulled from remote and
|
|
|
|
// $this->branch has been rebased on top of onto(by the rebase()
|
|
|
|
// function). So we're guaranteed to have onto as an ancestor of branch
|
|
|
|
// when we use first((onto::branch)-onto) below.
|
|
|
|
$branch_root = $repository_api->getCanonicalRevisionName(
|
2014-05-23 22:53:05 +02:00
|
|
|
hgsprintf('first((%s::%s)-%s)',
|
2012-12-06 04:31:25 +01:00
|
|
|
$this->onto,
|
|
|
|
$this->branch,
|
|
|
|
$this->onto));
|
|
|
|
|
2013-01-29 01:28:14 +01:00
|
|
|
$branch_range = hgsprintf(
|
2014-05-23 22:53:05 +02:00
|
|
|
'(%s::%s)',
|
2012-12-06 04:31:25 +01:00
|
|
|
$branch_root,
|
|
|
|
$this->branch);
|
|
|
|
|
|
|
|
if (!$this->keepBranch) {
|
|
|
|
$this->handleAlternateBranches($branch_root, $branch_range);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collapse just the landing branch onto master.
|
|
|
|
// Leave its children on the original branch.
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
$err = $repository_api->execPassthru(
|
2012-12-06 04:31:25 +01:00
|
|
|
'rebase --collapse --keep --logfile %s -r %s -d %s',
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->messageFile,
|
2012-12-06 04:31:25 +01:00
|
|
|
$branch_range,
|
|
|
|
$this->onto);
|
|
|
|
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
if ($err) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execManualLocal('rebase --abort');
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
$this->restoreBranch();
|
|
|
|
throw new ArcanistUsageException(
|
2015-05-13 10:05:15 +02:00
|
|
|
pht(
|
|
|
|
"Squashing the commits under %s failed. ".
|
|
|
|
"Manually squash your commits and run '%s' again.",
|
|
|
|
$this->branch,
|
|
|
|
'arc land'));
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($repository_api->isBookmark($this->branch)) {
|
|
|
|
// a bug in mercurial means bookmarks end up on the revision prior
|
|
|
|
// to the collapse when using --collapse with --keep,
|
|
|
|
// so we manually move them to the correct spots
|
|
|
|
// see: http://bz.selenic.com/show_bug.cgi?id=3716
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'bookmark -f %s',
|
|
|
|
$this->onto);
|
|
|
|
|
2012-12-06 04:31:25 +01:00
|
|
|
$repository_api->execxLocal(
|
|
|
|
'bookmark -f %s -r %s',
|
|
|
|
$this->branch,
|
|
|
|
$branch_rev_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if the branch had children
|
|
|
|
list($output) = $repository_api->execxLocal(
|
2014-05-23 22:53:05 +02:00
|
|
|
'log -r %s --template %s',
|
|
|
|
hgsprintf('children(%s)', $this->branch),
|
2013-08-15 03:00:51 +02:00
|
|
|
'{node}\n');
|
2012-12-06 04:31:25 +01:00
|
|
|
|
|
|
|
$child_branch_roots = phutil_split_lines($output, false);
|
|
|
|
$child_branch_roots = array_filter($child_branch_roots);
|
|
|
|
if ($child_branch_roots) {
|
|
|
|
// move the branch's children onto the collapsed commit
|
|
|
|
foreach ($child_branch_roots as $child_root) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$repository_api->execxLocal(
|
2012-12-06 04:31:25 +01:00
|
|
|
'rebase -d %s -s %s --keep --keepbranches',
|
|
|
|
$this->onto,
|
|
|
|
$child_root);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// All the rebases may have moved us to another branch
|
|
|
|
// so we move back.
|
|
|
|
$repository_api->execxLocal('checkout %s', $this->onto);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Detect alternate branches and prompt the user for how to handle
|
|
|
|
* them. An alternate branch is a branch that forks from the landing
|
|
|
|
* branch prior to the landing branch tip.
|
|
|
|
*
|
|
|
|
* In a situation like this:
|
|
|
|
* -a--------b master
|
|
|
|
* \
|
|
|
|
* w--x landingbranch
|
|
|
|
* \ \-- g subbranch
|
|
|
|
* \--y altbranch1
|
|
|
|
* \--z altbranch2
|
|
|
|
*
|
|
|
|
* y and z are alternate branches and will get deleted by the squash,
|
|
|
|
* so we need to detect them and ask the user what they want to do.
|
|
|
|
*
|
|
|
|
* @param string The revision id of the landing branch's root commit.
|
|
|
|
* @param string The revset specifying all the commits in the landing branch.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
private function handleAlternateBranches($branch_root, $branch_range) {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
|
|
|
// Using the tree in the doccomment, the revset below resolves as follows:
|
|
|
|
// 1. roots(descendants(w) - descendants(x) - (w::x))
|
|
|
|
// 2. roots({x,g,y,z} - {g} - {w,x})
|
|
|
|
// 3. roots({y,z})
|
|
|
|
// 4. {y,z}
|
2013-01-29 01:28:14 +01:00
|
|
|
$alt_branch_revset = hgsprintf(
|
|
|
|
'roots(descendants(%s)-descendants(%s)-%R)',
|
2012-12-06 04:31:25 +01:00
|
|
|
$branch_root,
|
|
|
|
$this->branch,
|
|
|
|
$branch_range);
|
|
|
|
list($alt_branches) = $repository_api->execxLocal(
|
2014-05-23 22:53:05 +02:00
|
|
|
'log --template %s -r %s',
|
2013-08-15 03:00:51 +02:00
|
|
|
'{node}\n',
|
2012-12-06 04:31:25 +01:00
|
|
|
$alt_branch_revset);
|
|
|
|
|
|
|
|
$alt_branches = phutil_split_lines($alt_branches, false);
|
|
|
|
$alt_branches = array_filter($alt_branches);
|
|
|
|
|
|
|
|
$alt_count = count($alt_branches);
|
|
|
|
if ($alt_count > 0) {
|
2014-04-09 21:35:31 +02:00
|
|
|
$input = phutil_console_prompt(pht(
|
|
|
|
"%s '%s' has %s %s(s) forking off of it that would be deleted ".
|
2013-03-01 23:04:05 +01:00
|
|
|
"during a squash. Would you like to keep a non-squashed copy, rebase ".
|
2014-04-09 21:35:31 +02:00
|
|
|
"them on top of '%s', or abort and deal with them yourself? ".
|
|
|
|
"(k)eep, (r)ebase, (a)bort:",
|
|
|
|
ucfirst($this->branchType),
|
|
|
|
$this->branch,
|
|
|
|
$alt_count,
|
|
|
|
$this->branchType,
|
|
|
|
$this->branch));
|
2012-12-06 04:31:25 +01:00
|
|
|
|
|
|
|
if ($input == 'k' || $input == 'keep') {
|
|
|
|
$this->keepBranch = true;
|
|
|
|
} else if ($input == 'r' || $input == 'rebase') {
|
|
|
|
foreach ($alt_branches as $alt_branch) {
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'rebase --keep --keepbranches -d %s -s %s',
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->branch,
|
2012-12-06 04:31:25 +01:00
|
|
|
$alt_branch);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
2012-12-06 04:31:25 +01:00
|
|
|
} else if ($input == 'a' || $input == 'abort') {
|
|
|
|
$branch_string = implode("\n", $alt_branches);
|
2014-04-09 21:35:31 +02:00
|
|
|
echo
|
|
|
|
"\n",
|
2015-05-13 10:05:15 +02:00
|
|
|
pht(
|
|
|
|
"Remove the %s starting at these revisions and run %s again:\n%s",
|
|
|
|
$this->branchType.'s',
|
|
|
|
$branch_string,
|
|
|
|
'arc land'),
|
2014-04-09 21:35:31 +02:00
|
|
|
"\n\n";
|
2012-12-06 04:31:25 +01:00
|
|
|
throw new ArcanistUserAbortException();
|
|
|
|
} else {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(
|
2014-05-23 22:53:05 +02:00
|
|
|
pht('Invalid choice. Aborting arc land.'));
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private function merge() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
|
|
|
|
// In immutable histories, do a --no-ff merge to force a merge commit with
|
|
|
|
// the right message.
|
|
|
|
$repository_api->execxLocal('checkout %s', $this->onto);
|
|
|
|
|
|
|
|
chdir($repository_api->getPath());
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($this->isGit) {
|
|
|
|
$err = phutil_passthru(
|
2013-04-06 18:23:41 +02:00
|
|
|
'git merge --no-stat --no-ff --no-commit %s',
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$this->branch);
|
2012-12-03 22:03:13 +01:00
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($err) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
"'%s' failed. Your working copy has been left in a partially ".
|
|
|
|
"merged state. You can: abort with '%s'; or follow the ".
|
|
|
|
"instructions to complete the merge.",
|
|
|
|
'git merge',
|
|
|
|
'git merge --abort'));
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
2013-01-16 21:15:46 +01:00
|
|
|
} else if ($this->isHg) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
// HG arc land currently doesn't support --merge.
|
|
|
|
// When merging a bookmark branch to a master branch that
|
|
|
|
// hasn't changed since the fork, mercurial fails to merge.
|
|
|
|
// Instead of only working in some cases, we just disable --merge
|
|
|
|
// until there is a demand for it.
|
|
|
|
// The user should never reach this line, since --merge is
|
|
|
|
// forbidden at the command line argument level.
|
2015-05-13 10:05:15 +02:00
|
|
|
throw new ArcanistUsageException(
|
|
|
|
pht('%s is not currently supported for hg repos.', '--merge'));
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private function push() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2015-05-13 10:05:15 +02:00
|
|
|
// These commands can fail legitimately (e.g. commit hooks)
|
2013-09-05 21:45:59 +02:00
|
|
|
try {
|
|
|
|
if ($this->isGit) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('commit -F %s', $this->messageFile);
|
2014-05-21 02:15:31 +02:00
|
|
|
if (phutil_is_windows()) {
|
2014-07-09 01:12:13 +02:00
|
|
|
// Occasionally on large repositories on Windows, Git can exit with
|
|
|
|
// an unclean working copy here. This prevents reverts from being
|
|
|
|
// pushed to the remote when this occurs.
|
2014-05-21 02:15:31 +02:00
|
|
|
$this->requireCleanWorkingCopy();
|
|
|
|
}
|
2013-09-05 21:45:59 +02:00
|
|
|
} else if ($this->isHg) {
|
|
|
|
// hg rebase produces a commit earlier as part of rebase
|
|
|
|
if (!$this->useSquash) {
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'commit --logfile %s',
|
|
|
|
$this->messageFile);
|
|
|
|
}
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
2013-09-05 21:45:59 +02:00
|
|
|
// We dispatch this event so we can run checks on the merged revision,
|
|
|
|
// right before it gets pushed out. It's easier to do this in arc land
|
|
|
|
// than to try to hook into git/hg.
|
2015-10-28 16:28:46 +01:00
|
|
|
$this->didCommitMerge();
|
2013-03-09 03:32:36 +01:00
|
|
|
} catch (Exception $ex) {
|
|
|
|
$this->executeCleanupAfterFailedPush();
|
|
|
|
throw $ex;
|
|
|
|
}
|
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
if ($this->getArgument('hold')) {
|
2014-04-09 21:35:31 +02:00
|
|
|
echo phutil_console_format(pht(
|
2014-05-23 22:53:05 +02:00
|
|
|
'Holding change in **%s**: it has NOT been pushed yet.',
|
2014-06-10 20:02:42 +02:00
|
|
|
$this->onto)."\n");
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
} else {
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht('Pushing change...'), "\n\n";
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2012-03-23 02:20:22 +01:00
|
|
|
chdir($repository_api->getPath());
|
2012-12-03 22:03:13 +01:00
|
|
|
|
2012-12-08 03:13:32 +01:00
|
|
|
if ($this->isGitSvn) {
|
|
|
|
$err = phutil_passthru('git svn dcommit');
|
2014-05-23 22:53:05 +02:00
|
|
|
$cmd = 'git svn dcommit';
|
2012-12-08 03:13:32 +01:00
|
|
|
} else if ($this->isGit) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$err = phutil_passthru('git push %s %s', $this->remote, $this->onto);
|
2014-05-23 22:53:05 +02:00
|
|
|
$cmd = 'git push';
|
2013-01-25 20:52:14 +01:00
|
|
|
} else if ($this->isHgSvn) {
|
|
|
|
// hg-svn doesn't support 'push -r', so we do a normal push
|
|
|
|
// which hg-svn modifies to only push the current branch and
|
|
|
|
// ancestors.
|
2015-05-13 10:05:15 +02:00
|
|
|
$err = $repository_api->execPassthru('push %s', $this->remote);
|
2014-05-23 22:53:05 +02:00
|
|
|
$cmd = 'hg push';
|
2012-12-21 23:18:07 +01:00
|
|
|
} else if ($this->isHg) {
|
2015-11-18 18:57:07 +01:00
|
|
|
if (strlen($this->remote)) {
|
|
|
|
$err = $repository_api->execPassthru(
|
|
|
|
'push -r %s %s',
|
|
|
|
$this->onto,
|
|
|
|
$this->remote);
|
|
|
|
} else {
|
|
|
|
$err = $repository_api->execPassthru(
|
|
|
|
'push -r %s',
|
|
|
|
$this->onto);
|
|
|
|
}
|
2014-05-23 22:53:05 +02:00
|
|
|
$cmd = 'hg push';
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
|
|
|
if ($err) {
|
2015-05-13 10:05:15 +02:00
|
|
|
echo phutil_console_format(
|
|
|
|
"<bg:red>** %s **</bg>\n",
|
|
|
|
pht('PUSH FAILED!'));
|
2013-03-09 03:32:36 +01:00
|
|
|
$this->executeCleanupAfterFailedPush();
|
2013-01-29 02:05:09 +01:00
|
|
|
if ($this->isGit) {
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
2015-05-13 10:05:15 +02:00
|
|
|
"'%s' failed! Fix the error and run '%s' again.",
|
|
|
|
$cmd,
|
|
|
|
'arc land'));
|
2013-01-29 02:05:09 +01:00
|
|
|
}
|
2014-04-09 21:35:31 +02:00
|
|
|
throw new ArcanistUsageException(pht(
|
|
|
|
"'%s' failed! Fix the error and push this change manually.",
|
|
|
|
$cmd));
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
|
|
|
|
2015-10-28 01:49:01 +01:00
|
|
|
$this->didPush();
|
2012-02-01 23:32:43 +01:00
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
echo "\n";
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2013-03-09 03:32:36 +01:00
|
|
|
private function executeCleanupAfterFailedPush() {
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
$repository_api = $this->getRepositoryAPI();
|
2013-03-09 03:32:36 +01:00
|
|
|
if ($this->isGit) {
|
|
|
|
$repository_api->execxLocal('reset --hard HEAD^');
|
|
|
|
$this->restoreBranch();
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
} else if ($this->isHg) {
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'--config extensions.mq= strip %s',
|
|
|
|
$this->onto);
|
|
|
|
$this->restoreBranch();
|
2013-03-09 03:32:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-03 22:03:13 +01:00
|
|
|
private function cleanupBranch() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht('Cleaning up feature %s...', $this->branchType), "\n";
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
if ($this->isGit) {
|
|
|
|
list($ref) = $repository_api->execxLocal(
|
|
|
|
'rev-parse --verify %s',
|
2012-12-03 22:03:13 +01:00
|
|
|
$this->branch);
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$ref = trim($ref);
|
|
|
|
$recovery_command = csprintf(
|
|
|
|
'git checkout -b %s %s',
|
|
|
|
$this->branch,
|
|
|
|
$ref);
|
2014-04-09 21:35:31 +02:00
|
|
|
echo pht('(Use `%s` if you want it back.)', $recovery_command), "\n";
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('branch -D %s', $this->branch);
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
} else if ($this->isHg) {
|
|
|
|
$common_ancestor = $repository_api->getCanonicalRevisionName(
|
2015-05-13 10:05:15 +02:00
|
|
|
hgsprintf('ancestor(%s,%s)', $this->onto, $this->branch));
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
|
|
|
|
$branch_root = $repository_api->getCanonicalRevisionName(
|
2014-05-23 22:53:05 +02:00
|
|
|
hgsprintf('first((%s::%s)-%s)',
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
$common_ancestor,
|
|
|
|
$this->branch,
|
|
|
|
$common_ancestor));
|
|
|
|
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'--config extensions.mq= strip -r %s',
|
|
|
|
$branch_root);
|
|
|
|
|
|
|
|
if ($repository_api->isBookmark($this->branch)) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('bookmark -d %s', $this->branch);
|
Make arc land for hg more robust to failures
Summary:
Adds error handling for several kinds of failure in arc land for
mercurial. Previously it would often leave the repo in a confusing state
if something failed.
- Aborts the land if pull brings in a diverged 'onto' branch.
- Aborts the rebase if there is a conflict. This leaves the repo exactly as
it was before, so the user is not left with a half finished rebase.
- Don't delete the original non-squashed branch until the push succeeds.
- If the push fails, strip the temporary squashed commit. This leaves the
'onto' branch back on the latest commit from the server, and leaves the users
original nonsquashed branch around.
- Always leave the user back on their original branch after an error.
Test Plan:
Ran arc land:
- with pull causing a diverged 'onto' bookmark
- with the 'onto' bookmark already diverged
- with the rebase causing conflicts
- with a push that failed due to a commit hook
- with a successful land
- with a successful collapse and land
In all failure cases the repo was left exactly as it was before arc land,
except for the push-failed case, where the only change was that the branch
was correctly on top of the destination branch due to a successful rebase.
Used bookmark name "foo bar-gah" to test that crazy bookmark names still work.
Reviewers: epriestley, dschleimer, sid0
Reviewed By: epriestley
CC: nh, wez, bos, aran, Korvin
Differential Revision: https://secure.phabricator.com/D5394
2013-03-20 23:06:10 +01:00
|
|
|
}
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->getArgument('delete-remote')) {
|
2017-06-09 15:52:18 +02:00
|
|
|
if ($this->isHg) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
// named branches were closed as part of the earlier commit
|
|
|
|
// so only worry about bookmarks
|
|
|
|
if ($repository_api->isBookmark($this->branch)) {
|
|
|
|
$repository_api->execxLocal(
|
|
|
|
'push -B %s %s',
|
|
|
|
$this->branch,
|
|
|
|
$this->remote);
|
|
|
|
}
|
2012-12-03 22:03:13 +01:00
|
|
|
}
|
|
|
|
}
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
|
|
|
|
2015-02-02 20:54:22 +01:00
|
|
|
public function getSupportedRevisionControlSystems() {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
return array('git', 'hg');
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|
|
|
|
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
private function getBranchOrBookmark() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
if ($this->isGit) {
|
|
|
|
$branch = $repository_api->getBranchName();
|
2015-10-28 01:49:01 +01:00
|
|
|
|
|
|
|
// If we don't have a branch name, just use whatever's at HEAD.
|
|
|
|
if (!strlen($branch) && !$this->isGitSvn) {
|
|
|
|
$branch = $repository_api->getWorkingCopyRevision();
|
|
|
|
}
|
2012-12-21 23:18:07 +01:00
|
|
|
} else if ($this->isHg) {
|
Add hg support for arc land
Summary:
Makes arc land support hg repositories. Both bookmarks and named branches can be landed. For the most part all the arc land options work, but there are a few caveats:
- bookmarks can only be landed on bookmarks
- branches can only be landed on branches
- landing a named branch with --merge creates a commit to close the branch before the merge.
- since mercurial doesn't start with a default master bookmark, landing a bookmark requires specifying --onto or setting arc.land.onto.default
Test Plan:
Tested arc land with all permutations of --merge, --keep-branch on both bookmark branches and named branches. Also tested --hold, --revision, --onto, --remote.
See https://secure.phabricator.com/P619
Also tested git arc land with --merge and --keep-branch.
Reviewers: dschleimer, sid0, epriestley, bos
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D4068
2012-12-04 02:59:12 +01:00
|
|
|
$branch = $repository_api->getActiveBookmark();
|
|
|
|
if (!$branch) {
|
|
|
|
$branch = $repository_api->getBranchName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $branch;
|
|
|
|
}
|
2012-12-21 23:18:07 +01:00
|
|
|
|
2013-03-01 23:04:05 +01:00
|
|
|
private function getBranchType($branch) {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
|
|
|
if ($this->isHg && $repository_api->isBookmark($branch)) {
|
2014-05-23 22:53:05 +02:00
|
|
|
return 'bookmark';
|
2013-03-01 23:04:05 +01:00
|
|
|
}
|
2014-05-23 22:53:05 +02:00
|
|
|
return 'branch';
|
2013-03-01 23:04:05 +01:00
|
|
|
}
|
2012-12-21 23:18:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Restore the original branch, e.g. after a successful land or a failed
|
|
|
|
* pull.
|
|
|
|
*/
|
|
|
|
private function restoreBranch() {
|
|
|
|
$repository_api = $this->getRepositoryAPI();
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('checkout %s', $this->oldBranch);
|
2013-09-05 21:45:59 +02:00
|
|
|
if ($this->isGit) {
|
2015-05-13 10:05:15 +02:00
|
|
|
$repository_api->execxLocal('submodule update --init --recursive');
|
2013-09-05 21:45:59 +02:00
|
|
|
}
|
2015-05-13 10:05:15 +02:00
|
|
|
echo pht(
|
|
|
|
"Switched back to %s %s.\n",
|
|
|
|
$this->branchType,
|
|
|
|
phutil_console_format('**%s**', $this->oldBranch));
|
2012-12-21 23:18:07 +01:00
|
|
|
}
|
|
|
|
|
2014-04-18 00:59:54 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if a diff has a running or failed buildable, and prompt the user
|
|
|
|
* before landing if it does.
|
|
|
|
*/
|
|
|
|
private function checkForBuildables($diff_phid) {
|
|
|
|
// NOTE: Since Harbormaster is still beta and this stuff all got added
|
|
|
|
// recently, just bail if we can't find a buildable. This is just an
|
|
|
|
// advisory check intended to prevent human error.
|
|
|
|
|
|
|
|
try {
|
|
|
|
$buildables = $this->getConduit()->callMethodSynchronous(
|
|
|
|
'harbormaster.querybuildables',
|
|
|
|
array(
|
|
|
|
'buildablePHIDs' => array($diff_phid),
|
|
|
|
'manualBuildables' => false,
|
|
|
|
));
|
|
|
|
} catch (ConduitClientException $ex) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$buildables['data']) {
|
|
|
|
// If there's no corresponding buildable, we're done.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$console = PhutilConsole::getConsole();
|
|
|
|
|
|
|
|
$buildable = head($buildables['data']);
|
|
|
|
|
|
|
|
if ($buildable['buildableStatus'] == 'passed') {
|
|
|
|
$console->writeOut(
|
|
|
|
"**<bg:green> %s </bg>** %s\n",
|
|
|
|
pht('BUILDS PASSED'),
|
2015-05-13 10:05:15 +02:00
|
|
|
pht('Harbormaster builds for the active diff completed successfully.'));
|
2014-04-18 00:59:54 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($buildable['buildableStatus']) {
|
|
|
|
case 'building':
|
|
|
|
$message = pht(
|
|
|
|
'Harbormaster is still building the active diff for this revision:');
|
|
|
|
$prompt = pht('Land revision anyway, despite ongoing build?');
|
|
|
|
break;
|
|
|
|
case 'failed':
|
|
|
|
$message = pht(
|
|
|
|
'Harbormaster failed to build the active diff for this revision. '.
|
|
|
|
'Build failures:');
|
|
|
|
$prompt = pht('Land revision anyway, despite build failures?');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// If we don't recognize the status, just bail.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$builds = $this->getConduit()->callMethodSynchronous(
|
|
|
|
'harbormaster.querybuilds',
|
|
|
|
array(
|
|
|
|
'buildablePHIDs' => array($buildable['phid']),
|
|
|
|
));
|
|
|
|
|
|
|
|
$console->writeOut($message."\n\n");
|
|
|
|
foreach ($builds['data'] as $build) {
|
|
|
|
switch ($build['buildStatus']) {
|
|
|
|
case 'failed':
|
|
|
|
$color = 'red';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$color = 'yellow';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$console->writeOut(
|
|
|
|
" **<bg:".$color."> %s </bg>** %s: %s\n",
|
|
|
|
phutil_utf8_strtoupper($build['buildStatusName']),
|
|
|
|
pht('Build %d', $build['id']),
|
|
|
|
$build['name']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$console->writeOut(
|
|
|
|
"\n%s\n\n **%s**: __%s__",
|
|
|
|
pht('You can review build details here:'),
|
|
|
|
pht('Harbormaster URI'),
|
|
|
|
$buildable['uri']);
|
|
|
|
|
2017-07-06 04:09:31 +02:00
|
|
|
if (!phutil_console_confirm($prompt)) {
|
2014-04-18 00:59:54 +02:00
|
|
|
throw new ArcanistUserAbortException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-28 01:49:01 +01:00
|
|
|
public function buildEngineMessage(ArcanistLandEngine $engine) {
|
|
|
|
// TODO: This is oh-so-gross.
|
|
|
|
$this->findRevision();
|
|
|
|
$engine->setCommitMessageFile($this->messageFile);
|
|
|
|
}
|
|
|
|
|
2015-10-28 16:28:46 +01:00
|
|
|
public function didCommitMerge() {
|
|
|
|
$this->dispatchEvent(
|
|
|
|
ArcanistEventType::TYPE_LAND_WILLPUSHREVISION,
|
|
|
|
array());
|
|
|
|
}
|
|
|
|
|
2015-10-28 01:49:01 +01:00
|
|
|
public function didPush() {
|
|
|
|
$this->askForRepositoryUpdate();
|
|
|
|
|
|
|
|
$mark_workflow = $this->buildChildWorkflow(
|
|
|
|
'close-revision',
|
|
|
|
array(
|
|
|
|
'--finalize',
|
|
|
|
'--quiet',
|
|
|
|
$this->revision['id'],
|
|
|
|
));
|
|
|
|
$mark_workflow->run();
|
|
|
|
}
|
|
|
|
|
Add "arc land" as a first-class workflow
Summary:
This is a fancy version of "land.sh" that uses "git merge --squash" and
"arc which" to cover more cases.
Test Plan:
Ran "arc land" against various repository states (no such branch, not
accepted, valid, etc). Things seemed OK. There are basically an infinite number
of states here so it's hard to test exhaustively.
Reviewers: cpiro, btrahan, jungejason, davidreuss
Reviewed By: davidreuss
CC: zeeg, aran, epriestley, davidreuss
Maniphest Tasks: T787, T723
Differential Revision: https://secure.phabricator.com/D1488
2012-01-26 00:10:59 +01:00
|
|
|
}
|