[PATCH 1 of 4] log: refactor: compute the value of last outside of filerevgen

Nicolas Dumazet nicdumz at gmail.com
Sat Jul 3 08:03:27 CDT 2010


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1278147528 -32400
# Branch stable
# Node ID df96d5cc7baf447d0253688bd53fae0f6e0f661d
# Parent  239f3210c970615dc1d5f861a92b61b4662a71a5
log: refactor: compute the value of last outside of filerevgen

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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


More information about the Mercurial-devel mailing list