[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Three-way merge markers by default

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 01 May 2014 18:33:25 +0100

Philip Martin <philip.martin_at_wandisco.com> writes:

> Daniel Shahaf <d.s_at_daniel.shahaf.name> writes:
>
>> --- subversion/libsvn_wc/merge.c 2011-08-06 19:15:44.000000000 +0400
>> +++ subversion/libsvn_wc/merge.c 2011-09-07 21:47:19.000000000 +0400
>> @@ -413,7 +413,7 @@
>> target_marker,
>> right_marker,
>> "=======", /* separator */
>> - svn_diff_conflict_display_modified_latest,
>> + svn_diff_conflict_display_modified_original_latest,
>> pool));
>> SVN_ERR(svn_stream_close(ostream));
>>
>
> We will also need to fix our testsuite to expect the new output.

Here's a patch that makes most of the testsuite PASS with the the new
output. I'm not sure it's correct as I cannot get merge_tests.py 34 to
PASS, at one point it seems to require both .merge-left.r2 and
.merge-left.r4.

Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c (revision 1591407)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -422,7 +422,7 @@ do_text_merge(svn_boolean_t *contains_conflicts,
                                       target_marker,
                                       right_marker,
                                       "=======", /* separator */
- svn_diff_conflict_display_modified_latest,
+ svn_diff_conflict_display_modified_original_latest,
                                       pool));
   SVN_ERR(svn_stream_close(ostream));
 
Index: subversion/tests/cmdline/basic_tests.py
===================================================================
--- subversion/tests/cmdline/basic_tests.py (revision 1591407)
+++ subversion/tests/cmdline/basic_tests.py (working copy)
@@ -682,6 +682,7 @@ def basic_conflict(sbox):
                       contents="\n".join(["This is the file 'mu'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for mu",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for mu",
                                           ">>>>>>> .r2",
@@ -690,6 +691,7 @@ def basic_conflict(sbox):
                       contents="\n".join(["This is the file 'rho'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for rho",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for rho",
                                           ">>>>>>> .r2",
@@ -2200,6 +2202,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'lambda'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for lambda",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for lambda",
                                           ">>>>>>> .r2",
@@ -2208,6 +2211,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'mu'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for mu",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for mu",
                                           ">>>>>>> .r2",
@@ -2216,6 +2220,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'rho'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for rho",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for rho",
                                           ">>>>>>> .r2",
@@ -2224,6 +2229,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'tau'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for tau",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for tau",
                                           ">>>>>>> .r2",
@@ -2232,6 +2238,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'omega'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for omega",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for omega",
                                           ">>>>>>> .r2",
@@ -2334,6 +2341,7 @@ def automatic_conflict_resolution(sbox):
                       contents="\n".join(["This is the file 'omega'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for omega",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for omega",
                                           ">>>>>>> .r2",
Index: subversion/tests/cmdline/checkout_tests.py
===================================================================
--- subversion/tests/cmdline/checkout_tests.py (revision 1591407)
+++ subversion/tests/cmdline/checkout_tests.py (working copy)
@@ -858,6 +858,7 @@ def co_with_obstructing_local_adds(sbox):
     'A/D/H/I/K/xi' : Item("This is file 'xi'\n"),
     'A/D/H/I/K/eta' : Item("\n".join(["<<<<<<< .mine",
                                       "This is WC file 'eta'",
+ "||||||| .r0",
                                       "=======",
                                       "This is REPOS file 'eta'",
                                       ">>>>>>> .r2",
@@ -865,6 +866,7 @@ def co_with_obstructing_local_adds(sbox):
     'A/D/H/I/L' : Item(),
     'A/D/kappa' : Item("\n".join(["<<<<<<< .mine",
                                       "This is WC file 'kappa'",
+ "||||||| .r0",
                                       "=======",
                                       "This is REPOS file 'kappa'",
                                       ">>>>>>> .r2",
Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 1591407)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -247,7 +247,7 @@ def textual_merges_galore(sbox):
 
   inject_conflict_into_expected_state('A/D/G/tau', expected_disk,
                                       expected_status, other_tau_text, tau_text,
- 3)
+ 1, 3)
 
   expected_skip = wc.State('', { })
 
@@ -336,7 +336,7 @@ def textual_merges_galore(sbox):
                                })
 
   inject_conflict_into_expected_state('tau', expected_disk, expected_status,
- other_tau_text, tau_text, 3)
+ other_tau_text, tau_text, 1, 3)
 
   # Do the merge, but check svn:mergeinfo props separately since
   # run_and_verify_merge would attempt to proplist tau's conflict
@@ -3000,7 +3000,7 @@ def cherry_pick_text_conflict(sbox):
     })
   expected_disk = wc.State('', {
     'mu' : Item("This is the file 'mu'.\n"
- + make_conflict_marker_text("r3\n" * 3, "r4\n" * 3, 4)),
+ + make_conflict_marker_text("r3\n" * 3, "r4\n" * 3, 3, 4)),
     'B' : Item(),
     'B/lambda' : Item("This is the file 'lambda'.\n"),
     'B/E' : Item(),
@@ -3515,6 +3515,7 @@ def merge_conflict_markers_matching_eol(sbox):
     'A/mu' : Item(contents= "This is the file 'mu'." + eolchar +
       "<<<<<<< .working" + eolchar +
       "Conflicting appended text for mu" + eolchar +
+ "||||||| .merge-left.r2" + eolchar +
       "=======" + eolchar +
       "Original appended text for mu" + eolchar +
       ">>>>>>> .merge-right.r" + str(cur_rev) + eolchar),
@@ -14836,6 +14837,8 @@ def merge_automatic_conflict_resolution(sbox):
     })
   expected_disk.tweak('D/H/psi', contents="<<<<<<< .working\n"
                       "BASE.\n"
+ "||||||| .merge-left.r2\n"
+ "This is the file 'psi'.\n"
                       "=======\n"
                       "New content>>>>>>> .merge-right.r3\n")
   expected_status.tweak('D/H/psi', status='C ')
@@ -18729,6 +18732,8 @@ def conflict_naming(sbox):
     'file.txt.r2' : Item(contents="This is the initial content\n"),
     'file.txt' : Item(contents="<<<<<<< .mine\n" \
                                "This is conflicting content\n" \
+ "||||||| .r3\n" \
+ "This is the new content\n" \
                                "=======\n" \
                                "This is the initial content\n" \
                                ">>>>>>> .r2\n"),
@@ -18760,6 +18765,8 @@ def conflict_naming(sbox):
     'file.txt.r2.txt' : Item(contents="This is the initial content\n"),
     'file.txt' : Item(contents="<<<<<<< .mine.txt\n" \
                                "This is conflicting content\n" \
+ "||||||| .r3.txt\n" \
+ "This is the new content\n" \
                                "=======\n" \
                                "This is the initial content\n" \
                                ">>>>>>> .r2.txt\n"),
@@ -18789,6 +18796,8 @@ def conflict_naming(sbox):
     'file.txt.merge-right.r2': Item(contents="This is the initial content\n"),
     'file.txt' : Item(contents="<<<<<<< .working\n" \
                                     "This is conflicting content\n" \
+ "||||||| .merge-left.r3\n" \
+ "This is the new content\n" \
                                     "=======\n" \
                                     "This is the initial content\n" \
                                     ">>>>>>> .merge-right.r2\n"),
@@ -18814,6 +18823,8 @@ def conflict_naming(sbox):
     'file.txt.merge-right.r2.txt': Item(contents="This is the initial content\n"),
     'file.txt' : Item(contents="<<<<<<< .working.txt\n" \
                                         "This is conflicting content\n" \
+ "||||||| .merge-left.r3.txt\n" \
+ "This is the new content\n" \
                                         "=======\n" \
                                         "This is the initial content\n" \
                                         ">>>>>>> .merge-right.r2.txt\n"),
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py (revision 1591407)
+++ subversion/tests/cmdline/svntest/actions.py (working copy)
@@ -2145,7 +2145,7 @@ def inject_conflict_into_wc(sbox, state_path, file
   inject_conflict_into_expected_state(state_path,
                                       expected_disk, expected_status,
                                       conflicting_contents, contents,
- merged_rev)
+ prev_rev, merged_rev)
   exit_code, output, errput = main.run_svn(None, "up", "-r", str(merged_rev),
                                            file_path)
   if expected_status:
@@ -2153,7 +2153,8 @@ def inject_conflict_into_wc(sbox, state_path, file
 
 def inject_conflict_into_expected_state(state_path,
                                         expected_disk, expected_status,
- wc_text, merged_text, merged_rev):
+ wc_text, merged_text, prev_rev,
+ merged_rev):
   """Update the EXPECTED_DISK and EXPECTED_STATUS trees for the
   conflict at STATE_PATH (ignored if None). WC_TEXT, MERGED_TEXT, and
   MERGED_REV are used to determine the contents of the conflict (the
@@ -2160,7 +2161,7 @@ def inject_conflict_into_expected_state(state_path
   text parameters should be newline-terminated)."""
   if expected_disk:
     conflict_marker = make_conflict_marker_text(wc_text, merged_text,
- merged_rev)
+ prev_rev, merged_rev)
     existing_text = expected_disk.desc[state_path].contents or ""
     expected_disk.tweak(state_path, contents=existing_text + conflict_marker)
 
@@ -2167,12 +2168,13 @@ def inject_conflict_into_expected_state(state_path
   if expected_status:
     expected_status.tweak(state_path, status='C ')
 
-def make_conflict_marker_text(wc_text, merged_text, merged_rev):
+def make_conflict_marker_text(wc_text, merged_text, prev_rev, merged_rev):
   """Return the conflict marker text described by WC_TEXT (the current
   text in the working copy, MERGED_TEXT (the conflicting text merged
   in), and MERGED_REV (the revision from whence the conflicting text
   came)."""
- return "<<<<<<< .working\n" + wc_text + "=======\n" + \
+ return "<<<<<<< .working\n" + wc_text + \
+ "||||||| .merge-left.r" + str(prev_rev) + "\n=======\n" + \
          merged_text + ">>>>>>> .merge-right.r" + str(merged_rev) + "\n"
 
 
Index: subversion/tests/cmdline/trans_tests.py
===================================================================
--- subversion/tests/cmdline/trans_tests.py (revision 1591407)
+++ subversion/tests/cmdline/trans_tests.py (working copy)
@@ -515,6 +515,17 @@ def update_modified_with_translation(sbox):
                                           "8",
                                           "9",
                                           "10",
+ "||||||| .r3",
+ "1",
+ "2",
+ "3",
+ "4",
+ "4.5",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
                                           "=======",
                                           "This is the file 'rho'.",
                                           ">>>>>>> .r1",
Index: subversion/tests/cmdline/update_tests.py
===================================================================
--- subversion/tests/cmdline/update_tests.py (revision 1591407)
+++ subversion/tests/cmdline/update_tests.py (working copy)
@@ -658,6 +658,7 @@ def update_to_resolve_text_conflicts(sbox):
                       contents="\n".join(["This is the file 'mu'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for mu",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for mu",
                                           ">>>>>>> .r2",
@@ -666,6 +667,7 @@ def update_to_resolve_text_conflicts(sbox):
                       contents="\n".join(["This is the file 'rho'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for rho",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for rho",
                                           ">>>>>>> .r2",
@@ -1798,6 +1800,7 @@ def conflict_markers_matching_eol(sbox):
     'A/mu' : Item(contents= "This is the file 'mu'." + eolchar +
       "<<<<<<< .mine" + eolchar +
       "Conflicting appended text for mu" + eolchar +
+ "||||||| .r2" + eolchar +
       "=======" + eolchar +
       "Original appended text for mu" + eolchar +
       ">>>>>>> .r" + str(cur_rev) + eolchar),
@@ -2737,6 +2740,7 @@ def update_with_obstructing_additions(sbox):
     'A/D/H/I/J' : Item(props={'propname1' : 'propval-WC'}),
     'A/D/H/I/J/eta' : Item("\n".join(["<<<<<<< .mine",
                                       "This is WC file 'eta'",
+ "||||||| .r0",
                                       "=======",
                                       "This is REPOS file 'eta'",
                                       ">>>>>>> .r2",
@@ -2746,6 +2750,7 @@ def update_with_obstructing_additions(sbox):
     'A/D/H/I/L' : Item(),
     'A/D/kappa' : Item("\n".join(["<<<<<<< .mine",
                                       "This is WC file 'kappa'",
+ "||||||| .r0",
                                       "=======",
                                       "This is REPOS file 'kappa'",
                                       ">>>>>>> .r2",
@@ -2753,6 +2758,7 @@ def update_with_obstructing_additions(sbox):
                            props={'propname1' : 'propval-WC'}),
     'A/D/epsilon' : Item("\n".join(["<<<<<<< .mine",
                                         "This is WC file 'epsilon'",
+ "||||||| .r0",
                                         "=======",
                                         "This is REPOS file 'epsilon'",
                                         ">>>>>>> .r2",
@@ -3033,6 +3039,7 @@ def update_conflicted(sbox):
                       contents="\n".join(["This is the file 'iota'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for iota",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for iota",
                                           ">>>>>>> .r2",
@@ -3041,6 +3048,7 @@ def update_conflicted(sbox):
                       contents="\n".join(["This is the file 'mu'.",
                                           "<<<<<<< .mine",
                                           "Conflicting appended text for mu",
+ "||||||| .r1",
                                           "=======",
                                           "Original appended text for mu",
                                           ">>>>>>> .r2",
@@ -3876,6 +3884,7 @@ def update_accept_conflicts(sbox):
   expected_disk.tweak('iota', contents=("This is the file 'iota'.\n"
                                         '<<<<<<< .mine\n'
                                         'My appended text for iota\n'
+ '||||||| .r1\n'
                                         '=======\n'
                                         'Their appended text for iota\n'
                                         '>>>>>>> .r2\n'))
@@ -3882,6 +3891,7 @@ def update_accept_conflicts(sbox):
   expected_disk.tweak('A/B/lambda', contents=("This is the file 'lambda'.\n"
                                               '<<<<<<< .mine\n'
                                               'My appended text for lambda\n'
+ '||||||| .r1\n'
                                               '=======\n'
                                               'Their appended text for lambda\n'
                                               '>>>>>>> .r2\n'))
@@ -3893,6 +3903,7 @@ def update_accept_conflicts(sbox):
   expected_disk.tweak('A/D/G/pi', contents=("This is the file 'pi'.\n"
                                              '<<<<<<< .mine\n'
                                              'My appended text for pi\n'
+ '||||||| .r1\n'
                                              '=======\n'
                                              'Their appended text for pi\n'
                                              '>>>>>>> .r2\n'
@@ -3900,6 +3911,7 @@ def update_accept_conflicts(sbox):
   expected_disk.tweak('A/D/G/rho', contents=("This is the file 'rho'.\n"
                                              '<<<<<<< .mine\n'
                                              'My appended text for rho\n'
+ '||||||| .r1\n'
                                              '=======\n'
                                              'Their appended text for rho\n'
                                              '>>>>>>> .r2\n'

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2014-05-01 19:33:59 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.