diff --git a/forwardport/changelog/2022-06/conflict-diff3.md b/forwardport/changelog/2022-06/conflict-diff3.md new file mode 100644 index 00000000..7dc4b4c0 --- /dev/null +++ b/forwardport/changelog/2022-06/conflict-diff3.md @@ -0,0 +1 @@ +IMP: use the `diff3` conflict style, should make forward port conflicts clearer and easier to fix diff --git a/forwardport/models/project.py b/forwardport/models/project.py index af22ef46..f9653cbb 100644 --- a/forwardport/models/project.py +++ b/forwardport/models/project.py @@ -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() diff --git a/forwardport/tests/test_conflicts.py b/forwardport/tests/test_conflicts.py index ea6c2844..0dd1c1c5 100644 --- a/forwardport/tests/test_conflicts.py +++ b/forwardport/tests/test_conflicts.py @@ -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* diff --git a/forwardport/tests/test_updates.py b/forwardport/tests/test_updates.py index 4f689246..cc7de7c2 100644 --- a/forwardport/tests/test_updates.py +++ b/forwardport/tests/test_updates.py @@ -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', }