Skip to content

Commit 670b957

Browse files
committed
Merge branch 'master' into external-MR
Conflicts: marge/single_merge_job.py
2 parents 3c4c6b1 + be6061e commit 670b957

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

marge/app.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,21 @@ def regexp(str_regex):
104104
'--use-merge-strategy',
105105
action='store_true',
106106
help=(
107-
'Use git merge instead of git rebase (EXPERIMENTAL)\n'
108-
'Enable if you use a workflow based on merge-commits and not linear history.\n'
107+
'Use git merge instead of git rebase to update the *source* branch (EXPERIMENTAL)\n'
108+
'If you need to use a strict no-rebase workflow (in most cases\n'
109+
'you don\'t want this, even if you configured gitlab to use merge requests\n'
110+
'to use merge commits on the *target* branch (the default).)'
109111
),
110112
)
111-
experimental_group.add_argument(
113+
parser.add_argument(
112114
'--add-tested',
113115
action='store_true',
114116
help='Add "Tested: marge-bot <$MR_URL>" for the final commit on branch after it passed CI.\n',
115117
)
116-
experimental_group.add_argument(
118+
parser.add_argument(
117119
'--batch',
118120
action='store_true',
119-
help='Enable processing MRs in batches (EXPERIMENTAL)\n',
121+
help='Enable processing MRs in batches\n',
120122
)
121123
parser.add_argument(
122124
'--add-part-of',
@@ -187,6 +189,11 @@ def regexp(str_regex):
187189
)
188190
config = parser.parse_args(args)
189191

192+
if config.use_merge_strategy and config.batch:
193+
raise MargeBotCliArgError('--use-merge-strategy and --batch are currently mutually exclusive')
194+
if config.use_merge_strategy and config.add_tested:
195+
raise MargeBotCliArgError('--use-merge-strategy and --add-tested are currently mutually exclusive')
196+
190197
cli_args = []
191198
# pylint: disable=protected-access
192199
for _, (_, value) in parser._source_to_settings.get(configargparse._COMMAND_LINE_SOURCE_KEY, {}).items():

marge/single_merge_job.py

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ def update_merge_request_and_accept(self, approvals):
7171
time.sleep(2)
7272
if self.opts.temp_branch and source_project is not self._project:
7373
trust = False
74+
75+
self.ensure_mergeable_mr(merge_request)
76+
7477
try:
7578
merge_request.accept(remove_branch=True, sha=actual_sha, trust_pipeline=trust,
7679
project=self._project)

tests/test_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_add_tested():
118118

119119
def test_use_merge_strategy_and_add_tested_are_mutualy_exclusive():
120120
with env(MARGE_AUTH_TOKEN="NON-ADMIN-TOKEN", MARGE_SSH_KEY="KEY", MARGE_GITLAB_URL='http://foo.com'):
121-
with pytest.raises(SystemExit):
121+
with pytest.raises(app.MargeBotCliArgError):
122122
with main('--use-merge-strategy --add-tested'):
123123
pass
124124

0 commit comments

Comments
 (0)