diff mercurial/filemerge.py @ 21524:47b97d9af27e

merge: add labels parameter from merge.update to filemerge Adds a labels function parameter to all the functions between merge.update and filemerge.filemerge. This will allow commands like rebase to specify custom marker labels.
author Durham Goode <durham@fb.com>
date Thu, 08 May 2014 16:54:23 -0700
parents 25d5a9ecbb85
children 9c35f3a8cac4
line wrap: on
line diff
--- a/mercurial/filemerge.py	Tue Apr 22 13:32:05 2014 -0700
+++ b/mercurial/filemerge.py	Thu May 08 16:54:23 2014 -0700
@@ -300,6 +300,8 @@
     '{ifeq(branch, "default", "", "{branch} ")}' +
     '- {author|user}: "{desc|firstline}"')
 
+_defaultconflictlabels = ['local', 'other']
+
 def _formatlabels(repo, fcd, fco, labels):
     """Formats the given labels using the conflict marker template.
 
@@ -318,7 +320,7 @@
     return [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
             _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
 
-def filemerge(repo, mynode, orig, fcd, fco, fca):
+def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
     """perform a 3-way merge in the working directory
 
     mynode = parent node before merge
@@ -376,10 +378,12 @@
     ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
 
     markerstyle = ui.config('ui', 'mergemarkers', 'detailed')
-    labels = ['local', 'other']
     if markerstyle == 'basic':
-        formattedlabels = labels
+        formattedlabels = _defaultconflictlabels
     else:
+        if not labels:
+            labels = _defaultconflictlabels
+
         formattedlabels = _formatlabels(repo, fcd, fco, labels)
 
     needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,