1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12:41 +01:00

Add arc.land.update.default config for setting the default strategy

Summary:
This adds a arcconfig setting to allow specifying whether to use the merge
or rebase strategy when doing the feature branch update.
arc.land.update.default can be set to either 'rebase' or 'merge'.  The command
line flags will override this setting.

We have had trouble with arc land producing merge commits (introduced
with D4080) in git. They usually appear when arc land fails, and our users
are confused by the presence of a merge commit afterwards. Today it got even
worse since a user managed to get arc land to push the merge commit to the
server. This setting will allow us to turn it off for our uses.

Test Plan:
Verified the following combinations:
update.default not set + arc land (saw git merge in the trace)
update.default = 'rebase' + arc land (saw git rebase)
update.default = 'merge' + arc land (saw git merge)
update.default = 'rebase' + arc land --update-with-merge (saw git merge)
update.default = 'merge' + arc land --update-with-rebase (saw git rebase)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5683
This commit is contained in:
durham 2013-04-14 11:48:22 -07:00
parent f5c8430188
commit e573610ce4
2 changed files with 48 additions and 4 deletions

View file

@ -48,6 +48,13 @@ final class ArcanistSettings {
'engine is specified by the current project.', 'engine is specified by the current project.',
'example' => '"ExampleUnitTestEngine"', 'example' => '"ExampleUnitTestEngine"',
), ),
'arc.feature.start.default' => array(
'type' => 'string',
'help' =>
'The name of the default branch to create the new feature branch '.
'off of.',
'example' => '"develop"',
),
'arc.land.onto.default' => array( 'arc.land.onto.default' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' =>
@ -55,6 +62,13 @@ final class ArcanistSettings {
'`arc land` is run.', '`arc land` is run.',
'example' => '"develop"', 'example' => '"develop"',
), ),
'arc.land.update.default' => array(
'type' => 'string',
'help' =>
'The default strategy to use when arc land updates the feature '.
'branch. Supports \'rebase\' and \'merge\' strategies.',
'example' => '"rebase"',
),
'history.immutable' => array( 'history.immutable' => array(
'type' => 'bool', 'type' => 'bool',
'legacy' => 'immutable_history', 'legacy' => 'immutable_history',

View file

@ -121,10 +121,29 @@ EOTEXT
), ),
), ),
'update-with-rebase' => array( 'update-with-rebase' => array(
'help' => 'When updating the feature branch, use rebase intead of '. 'help' => 'When updating the feature branch, use rebase instead of '.
'merge. This might make things work better in some cases.', 'merge. This might make things work better in some cases.'.
'Set arc.land.update.default to \'rebase\' to make this '.
'default.',
'conflicts' => array( 'conflicts' => array(
'merge' => 'The --merge strategy does not update the feature branch.', 'merge' => 'The --merge strategy does not update the feature branch.',
'update-with-merge' => 'Cannot be used with --update-with-merge.',
),
'supports' => array(
'git',
),
),
'update-with-merge' => array(
'help' => 'When updating the feature branch, use merge instead of '.
'rebase. This is the default behavior. '.
'Setting arc.land.update.default to \'merge\' can also '.
'be used to make this the default.',
'conflicts' => array(
'merge' => 'The --merge strategy does not update the feature branch.',
'update-with-rebase' => 'Cannot be used with --update-with-rebase.',
),
'supports' => array(
'git',
), ),
), ),
'revision' => array( 'revision' => array(
@ -222,7 +241,18 @@ EOTEXT
} }
$this->branch = head($branch); $this->branch = head($branch);
$this->keepBranch = $this->getArgument('keep-branch'); $this->keepBranch = $this->getArgument('keep-branch');
$this->shouldUpdateWithRebase = $this->getArgument('update-with-rebase');
$working_copy = $this->getWorkingCopy();
$update_strategy = $working_copy->getConfigFromAnySource(
'arc.land.update.default',
'merge');
$this->shouldUpdateWithRebase = $update_strategy == 'rebase';
if ($this->getArgument('update-with-rebase')) {
$this->shouldUpdateWithRebase = true;
} else if ($this->getArgument('update-with-merge')) {
$this->shouldUpdateWithRebase = false;
}
$this->preview = $this->getArgument('preview'); $this->preview = $this->getArgument('preview');
if (!$this->branchType) { if (!$this->branchType) {
@ -231,7 +261,7 @@ EOTEXT
$onto_default = $this->isGit ? 'master' : 'default'; $onto_default = $this->isGit ? 'master' : 'default';
$onto_default = nonempty( $onto_default = nonempty(
$this->getWorkingCopy()->getConfigFromAnySource('arc.land.onto.default'), $working_copy->getConfigFromAnySource('arc.land.onto.default'),
$onto_default); $onto_default);
$this->onto = $this->getArgument('onto', $onto_default); $this->onto = $this->getArgument('onto', $onto_default);
$this->ontoType = $this->getBranchType($this->onto); $this->ontoType = $this->getBranchType($this->onto);