changeset 11606:326ab8727a93

log: refactor: compute the value of last outside of filerevgen
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Sat, 03 Jul 2010 17:58:48 +0900
parents 2eab5025f804
children cc784ad8b3da
files mercurial/cmdutil.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Jul 16 18:35:15 2010 +0200
+++ b/mercurial/cmdutil.py	Sat Jul 03 17:58:48 2010 +0900
@@ -1052,12 +1052,8 @@
 
     if not slowpath:
         # Only files, no patterns.  Check the history of each file.
-        def filerevgen(filelog, node):
+        def filerevgen(filelog, last):
             cl_count = len(repo)
-            if node is None:
-                last = len(filelog) - 1
-            else:
-                last = filelog.rev(node)
             for i, window in increasing_windows(last, nullrev):
                 revs = []
                 for j in xrange(i - window, i + 1):
@@ -1088,7 +1084,13 @@
                     break
                 else:
                     continue
-            for rev, copied in filerevgen(filelog, node):
+
+            if node is None:
+                last = len(filelog) - 1
+            else:
+                last = filelog.rev(node)
+
+            for rev, copied in filerevgen(filelog, last):
                 if rev <= maxrev:
                     if rev < minrev:
                         break