[FIX] forwardport: use diff3 for conflict style

Existing conflict style is the local default ("merge", most
likely). `diff3` is a lot more informative as it provides the common
ancestor's code for the hunk, which helps see how the two branches
diverged and thus resolve the conflict.

Even better would be zdiff3 but that's a bit too recent...

Fixes #619
This commit is contained in:
Xavier Morel 2022-06-24 15:57:45 +02:00
parent f430c014c1
commit fb45f089b0
4 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1 @@
IMP: use the `diff3` conflict style, should make forward port conflicts clearer and easier to fix

View File

@ -870,7 +870,7 @@ This PR targets %s and is part of the forward-port chain. Further PRs will be cr
# switch back to the PR branch
conf.checkout(fp_branch_name)
# cherry-pick the squashed commit to generate the conflict
conf.with_params('merge.renamelimit=0')\
conf.with_params('merge.renamelimit=0', 'merge.conflictstyle=diff3')\
.with_config(check=False)\
.cherry_pick(squashed, no_commit=True)
status = conf.stdout().status(short=True, untracked_files='no').stdout.decode()

View File

@ -60,9 +60,10 @@ def test_conflict(env, config, make_repo, users):
'g': 'a',
'h': re_matches(r'''<<<\x3c<<< HEAD
a
|||||||| parent of [\da-f]{7,}.*
=======
xxx
>>>\x3e>>> [0-9a-f]{7,}.*
>>>\x3e>>> [\da-f]{7,}.*
'''),
}
prb = prod.get_pr(prb_id.number)
@ -323,9 +324,10 @@ def test_multiple_commits_different_authorship(env, config, make_repo, users, ro
assert re.match(r'''<<<\x3c<<< HEAD
b
|||||||| parent of [\da-f]{7,}.*
=======
2
>>>\x3e>>> [0-9a-f]{7,}.*
>>>\x3e>>> [\da-f]{7,}.*
''', prod.read_tree(c)['g'])
# I'd like to fix the conflict so everything is clean and proper *but*

View File

@ -374,9 +374,10 @@ def test_subsequent_conflict(env, make_repo, config, users):
'g': 'a',
'h': re_matches(r'''<<<\x3c<<< HEAD
a
|||||||| parent of [\da-f]{7,}.*
=======
conflict!
>>>\x3e>>> [0-9a-f]{7,}.*
>>>\x3e>>> [\da-f]{7,}.*
'''),
'x': '0',
}