This is an archive of the discontinued Mercurial Phabricator instance.

filemerge: extract `_picklabels` as a helper function
ClosedPublic

Authored by phillco on Aug 14 2017, 2:15 AM.

Details

Summary

This shortens simplemerge() and is a bit cleaner, IMO.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

phillco created this revision.Aug 14 2017, 2:15 AM
This revision was automatically updated to reflect the committed changes.
martinvonz added inline comments.
mercurial/simplemerge.py
411–423
def _picklabels(defaults, overrides):
  if len(overrides) > 3:
        raise error.Abort(_("can only specify three labels."))
  result = defaults[:]
  for i, override in enumerate(overrides):
    result[i] = override
  return result

no?

phillco added inline comments.Aug 19 2017, 1:42 PM
mercurial/simplemerge.py
411–423

I think so, not sure why the original was so weird. I'll replace it.