simplemerge: refactor _picklabels to be more compact
Use @martinvonz's suggestion from D376.
Differential Revision: https://phab.mercurial-scm.org/D521
--- a/mercurial/simplemerge.py Fri Aug 25 13:49:16 2017 -0700
+++ b/mercurial/simplemerge.py Fri Aug 25 13:49:17 2017 -0700
@@ -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.