[Updated] D11977: simplemerge: move default labels to simplemerge extension

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


Closed by commit rHG36f1591316aa: simplemerge: move default labels to simplemerge extension (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/D11977?vs=31632&id=31671

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

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

AFFECTED FILES
  contrib/simplemerge
  mercurial/simplemerge.py

CHANGE DETAILS

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -332,10 +332,10 @@
     return text
 
 
-def _picklabels(defaults, overrides):
+def _picklabels(overrides):
     if len(overrides) > 3:
         raise error.Abort(_(b"can only specify three labels."))
-    result = defaults[:]
+    result = [None, None, None]
     for i, override in enumerate(overrides):
         result[i] = override
     return result
@@ -501,9 +501,7 @@
     elif mode == b'other':
         lines = _resolve(m3, (2,))
     else:
-        name_a, name_b, name_base = _picklabels(
-            [localctx.path(), otherctx.path(), None], opts.get('label', [])
-        )
+        name_a, name_b, name_base = _picklabels(opts.get('label', []))
         if mode == b'mergediff':
             lines, conflicts = render_mergediff(m3, name_a, name_b, name_base)
         else:
diff --git a/contrib/simplemerge b/contrib/simplemerge
--- a/contrib/simplemerge
+++ b/contrib/simplemerge
@@ -83,6 +83,10 @@
     if len(opts[b'label']) > 2:
         opts[b'mode'] = b'merge3'
     local, base, other = args
+    overrides = opts[b'label']
+    labels = [local, other, base]
+    labels[: len(overrides)] = overrides
+    opts[b'label'] = labels
     sys.exit(
         simplemerge.simplemerge(
             uimod.ui.load(),



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/544a0312/attachment-0002.html>


More information about the Mercurial-patches mailing list