# HG changeset patch # User Martin von Zweigbergk # Date 2019-01-24 20:38:19 # Node ID 5079242abef9601a1007015a9b5191d40553009d # Parent 609d6d8646dbc95025bc8d9381ab37b27520f079 revpair: simplify revpair by always relying on smartset.first/last I thinkt the code was written the way it was because it comes from 97b2f26dfc43 (revpair: smartset compatibility, 2014-03-20) and the first/last methods came only later, in 228b0aafb1ce (smartset: add first and last methods, 2014-10-06). Differential Revision: https://phab.mercurial-scm.org/D5687 diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -672,17 +672,8 @@ def revpair(repo, revs): l = revrange(repo, revs) - if not l: - first = second = None - elif l.isascending(): - first = l.min() - second = l.max() - elif l.isdescending(): - first = l.max() - second = l.min() - else: - first = l.first() - second = l.last() + first = l.first() + second = l.last() if first is None: raise error.Abort(_('empty revision range'))