log: refactor: compute the value of last outside of filerevgen
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Sat, 03 Jul 2010 17:58:48 +0900
changeset 11606 326ab8727a93
parent 11603 2eab5025f804
child 11607 cc784ad8b3da
log: refactor: compute the value of last outside of filerevgen
mercurial/cmdutil.py
--- 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