changeset 20756:e7833e63bb42

cmdutil: changed code in _makegraphlogrevset not to use getitem __getitem__ is a method that is not implemented lazily on many of the new classes and it can be easily replaced with a structure that takes advantage of the new lazy implementations instead.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Fri, 14 Mar 2014 11:35:17 -0700
parents cfd03c069e08
children 3813a1dd9eb9
files mercurial/cmdutil.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Mar 14 08:43:52 2014 -0700
+++ b/mercurial/cmdutil.py	Fri Mar 14 11:35:17 2014 -0700
@@ -1515,8 +1515,12 @@
     follow = opts.get('follow') or opts.get('follow_first')
     followfirst = opts.get('follow_first') and 1 or 0
     # --follow with FILE behaviour depends on revs...
-    startrev = revs[0]
-    followdescendants = (len(revs) > 1 and revs[0] < revs[1]) and 1 or 0
+    it = iter(revs)
+    startrev = it.next()
+    try:
+        followdescendants = startrev < it.next()
+    except (StopIteration):
+        followdescendants = False
 
     # branch and only_branch are really aliases and must be handled at
     # the same time