[IMP] forwardport: unweird singleton conflicting commits

When creating the conflicting commit of a single commit PR, reuse the
original commit's meta-information so the developer / fixer can more
easily update it in-place.

Closes #204
This commit is contained in:
Xavier Morel 2019-09-20 16:07:22 +02:00
parent 446b11a28f
commit 8de6273498

View File

@ -605,8 +605,7 @@ More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
working_copy.checkout('-bsquashed', root_branch)
root_commits = root.commits()
# squash to a single commit: reset to the first parent of the pr's
# first commit
# squash to a single commit
working_copy.reset('--soft', root_commits[0]['parents'][0]['sha'])
working_copy.commit(a=True, message="temp")
squashed = working_copy.stdout().rev_parse('HEAD').stdout.strip().decode()
@ -616,9 +615,15 @@ More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
# cherry-pick the squashed commit
working_copy.with_params('merge.renamelimit=0').with_config(check=False).cherry_pick(squashed)
working_copy.commit(
a=True, allow_empty=True,
message="""Cherry pick of %s failed
# if there was a single commit, reuse its message when committing
# the conflict
# TODO: still add conflict information to this?
if len(root_commits) == 1:
working_copy.commit(all=True, allow_empty=True, reuse_message=root_commits[0]['sha'])
else:
working_copy.commit(
all=True, allow_empty=True,
message="""Cherry pick of %s failed
stdout:
%s