[Updated] D11903: simplemerge: don't calculate conflict labels when resolving automatically

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Dec 21 15:05:29 UTC 2021


Closed by commit rHG59524cb1cd73: simplemerge: don't calculate conflict labels when resolving automatically (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11903?vs=31438&id=31559

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11903/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11903

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -503,13 +503,6 @@
         # repository usually sees) might be more useful.
         return _verifytext(ctx.decodeddata(), ctx.path(), ui, opts)
 
-    mode = opts.get('mode', b'merge')
-    name_a, name_b, name_base = None, None, None
-    if mode != b'union':
-        name_a, name_b, name_base = _picklabels(
-            [localctx.path(), otherctx.path(), None], opts.get('label', [])
-        )
-
     try:
         localtext = readctx(localctx)
         basetext = readctx(basectx)
@@ -519,26 +512,31 @@
 
     m3 = Merge3Text(basetext, localtext, othertext)
     conflicts = False
+    mode = opts.get('mode', b'merge')
     if mode == b'union':
         lines = _resolve(m3, (1, 2))
     elif mode == b'local':
         lines = _resolve(m3, (1,))
     elif mode == b'other':
         lines = _resolve(m3, (2,))
-    elif mode == b'mergediff':
-        lines, conflicts = _mergediff(m3, name_a, name_b, name_base)
     else:
-        extrakwargs = {
-            'minimize': True,
-        }
-        if name_base is not None:
-            extrakwargs['base_marker'] = b'|||||||'
-            extrakwargs['name_base'] = name_base
-            extrakwargs['minimize'] = False
-        lines = list(
-            m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs)
+        name_a, name_b, name_base = _picklabels(
+            [localctx.path(), otherctx.path(), None], opts.get('label', [])
         )
-        conflicts = m3.conflicts
+        if mode == b'mergediff':
+            lines, conflicts = _mergediff(m3, name_a, name_b, name_base)
+        else:
+            extrakwargs = {
+                'minimize': True,
+            }
+            if name_base is not None:
+                extrakwargs['base_marker'] = b'|||||||'
+                extrakwargs['name_base'] = name_base
+                extrakwargs['minimize'] = False
+            lines = list(
+                m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs)
+            )
+            conflicts = m3.conflicts
 
     mergedtext = b''.join(lines)
     if opts.get('print'):



To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211221/c478acc0/attachment-0002.html>


More information about the Mercurial-patches mailing list