changeset 41369:5079242abef9

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
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 24 Jan 2019 12:38:19 -0800
parents 609d6d8646db
children a728ef2f9b15
files mercurial/scmutil.py
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Fri Jan 18 11:10:30 2019 -0800
+++ b/mercurial/scmutil.py	Thu Jan 24 12:38:19 2019 -0800
@@ -672,17 +672,8 @@
 
     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'))