Patchwork D521: simplemerge: refactor _picklabels to be more compact

login
register
mail settings
Submitter phabricator
Date Aug. 25, 2017, 10:56 p.m.
Message ID <20fe6c577c061ec51786231ea3e0b862@localhost.localdomain>
Download mbox | patch
Permalink /patch/23362/
State Not Applicable
Headers show

Comments

phabricator - Aug. 25, 2017, 10:56 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG39d253d088a9: simplemerge: refactor _picklabels to be more compact (authored by phillco).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D521?vs=1301&id=1314

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

AFFECTED FILES
  mercurial/simplemerge.py

CHANGE DETAILS




To: phillco, #hg-reviewers
Cc: martinvonz, mercurial-devel

Patch

diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -406,18 +406,12 @@ 
     return text
 
 def _picklabels(defaults, overrides):
-    name_a, name_b, name_base = defaults
-
-    if len(overrides) > 0:
-        name_a = overrides[0]
-    if len(overrides) > 1:
-        name_b = overrides[1]
-    if len(overrides) > 2:
-        name_base = overrides[2]
     if len(overrides) > 3:
         raise error.Abort(_("can only specify three labels."))
-
-    return [name_a, name_b, name_base]
+    result = defaults[:]
+    for i, override in enumerate(overrides):
+        result[i] = override
+    return result
 
 def simplemerge(ui, localctx, basectx, otherctx, repo=None, **opts):
     """Performs the simplemerge algorithm.