Mercurial > hg
changeset 33933:39d253d088a9
simplemerge: refactor _picklabels to be more compact
Use @martinvonz's suggestion from D376.
Differential Revision: https://phab.mercurial-scm.org/D521
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Fri, 25 Aug 2017 13:49:17 -0700 |
parents | 3b2a002ef685 |
children | 6cc8f848b4c3 |
files | mercurial/simplemerge.py |
diffstat | 1 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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.