Patchwork [1,of,7] merge: refactor labels selection code

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 5, 2014, 12:28 a.m.
Message ID <43d2c747287871d320bf.1407198487@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5257/
State Accepted
Commit e9801c7b6ff0cfd7578f34a4a2cb40a91dc60e14
Headers show

Comments

Pierre-Yves David - Aug. 5, 2014, 12:28 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1402382256 25200
#      Mon Jun 09 23:37:36 2014 -0700
# Node ID 43d2c747287871d320bf740ff279991fb9971c5e
# Parent  c6e1f2c6d5f19538869338fa50ad519be6eb9b24
merge: refactor labels selection code

The code is simplified to prepare the future introduction of a third labels for
the merge base.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -386,20 +386,17 @@  def filemerge(repo, mynode, orig, fcd, f
         ui.status(_("merging %s\n") % fd)
 
     ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
 
     markerstyle = ui.config('ui', 'mergemarkers', 'basic')
-    if markerstyle == 'basic':
-        formattedlabels = _defaultconflictlabels
-    else:
-        if not labels:
-            labels = _defaultconflictlabels
-
-        formattedlabels = _formatlabels(repo, fcd, fco, labels)
+    if not labels:
+        labels = _defaultconflictlabels
+    if markerstyle != 'basic':
+        labels = _formatlabels(repo, fcd, fco, labels)
 
     needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
-                        (a, b, c, back), labels=formattedlabels)
+                        (a, b, c, back), labels=labels)
     if not needcheck:
         if r:
             if onfailure:
                 ui.warn(onfailure % fd)
         else: