[Updated] D11972: simplemerge: use 3-way markers if mode=='merge3', ignoring number of labels

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jan 17 13:14:09 UTC 2022


Closed by commit rHG18a01dce3d22: simplemerge: use 3-way markers if mode=='merge3', ignoring number of labels (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/D11972?vs=31627&id=31666

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

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

AFFECTED FILES
  contrib/simplemerge
  mercurial/filemerge.py
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -506,7 +506,7 @@
             extrakwargs = {
                 'minimize': True,
             }
-            if name_base is not None:
+            if mode == b'merge3':
                 extrakwargs['base_marker'] = b'|||||||'
                 extrakwargs['name_base'] = name_base
                 extrakwargs['minimize'] = False
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -421,14 +421,15 @@
             )
 
     if premerge:
+        if not labels:
+            labels = _defaultconflictlabels
+        if len(labels) < 3:
+            labels.append(b'base')
         mode = b'merge'
-        if premerge in {b'keep-merge3', b'keep-mergediff'}:
-            if not labels:
-                labels = _defaultconflictlabels
-            if len(labels) < 3:
-                labels.append(b'base')
-            if premerge == b'keep-mergediff':
-                mode = b'mergediff'
+        if premerge == b'keep-mergediff':
+            mode = b'mergediff'
+        elif premerge == b'keep-merge3':
+            mode = b'merge3'
         r = simplemerge.simplemerge(
             ui, fcd, fca, fco, quiet=True, label=labels, mode=mode
         )
@@ -532,7 +533,9 @@
         labels = _defaultconflictlabels
     if len(labels) < 3:
         labels.append(b'base')
-    return _imerge(repo, mynode, fcd, fco, fca, toolconf, backup, labels)
+    return _merge(
+        repo, mynode, fcd, fco, fca, toolconf, backup, labels, b'merge3'
+    )
 
 
 @internaltool(
diff --git a/contrib/simplemerge b/contrib/simplemerge
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -80,6 +80,8 @@
         sys.exit(0)
     if len(args) != 3:
         raise ParseError(_(b'wrong number of arguments').decode('utf8'))
+    if len(opts[b'label']) > 2:
+        opts[b'mode'] = b'merge3'
     local, base, other = args
     sys.exit(
         simplemerge.simplemerge(



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/20220117/b18c2039/attachment-0002.html>


More information about the Mercurial-patches mailing list