changeset 48583:a809f1465a76

filemerge: set default labels a little earlier By setting the default labels a little earlier, we can rely on them always being set, as far as I can tell. It may actually even be fine to rely on that even if we don't set them earlier, but it makes more sense to me to do it. Differential Revision: https://phab.mercurial-scm.org/D12015
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 20 Jan 2022 13:43:43 -0800
parents f970bc616ebc
children 74973a6d4e67
files mercurial/filemerge.py
diffstat 1 files changed, 2 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Thu Jan 20 11:17:09 2022 -0800
+++ b/mercurial/filemerge.py	Thu Jan 20 13:43:43 2022 -0800
@@ -535,8 +535,6 @@
     files. It will fail if there are any conflicts and leave markers in
     the partially merged file. Marker will have three sections, one from each
     side of the merge and one for the base content."""
-    if not labels:
-        labels = _defaultconflictlabels
     if len(labels) < 3:
         labels.append(b'base')
     return _merge(repo, fcd, fco, fca, labels, b'merge3')
@@ -577,8 +575,6 @@
     the partially merged file. The marker will have two sections, one with the
     content from one side of the merge, and one with a diff from the base
     content to the content on the other side. (experimental)"""
-    if not labels:
-        labels = _defaultconflictlabels
     if len(labels) < 3:
         labels.append(b'base')
     return _merge(repo, fcd, fco, fca, labels, b'mergediff')
@@ -841,9 +837,6 @@
     return stringutil.ellipsis(mark, 80 - 8)
 
 
-_defaultconflictlabels = [b'local', b'other']
-
-
 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
     """Formats the given labels using the conflict marker template.
 
@@ -1068,6 +1061,8 @@
 
     toolconf = tool, toolpath, binary, symlink, scriptfn
 
+    if not labels:
+        labels = [b'local', b'other']
     if mergetype == nomerge:
         return func(repo, mynode, fcd, fco, fca, toolconf, labels)
 
@@ -1099,8 +1094,6 @@
         else:
             markerstyle = internalmarkerstyle
 
-        if not labels:
-            labels = _defaultconflictlabels
         formattedlabels = labels
         if markerstyle != b'basic':
             formattedlabels = _formatlabels(