commands: exit from the log loop at the right time
authorBryan O'Sullivan <bryano@fb.com>
Wed, 20 Feb 2013 11:31:41 -0800
changeset 18711 6b786dc88612
parent 18710 49ef9d0ca815
child 18712 e3ddb4068757
commands: exit from the log loop at the right time Previously, we'd run the iterator one more time than necessary, potentially doing a lot of extra work in the process.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Feb 20 11:31:38 2013 -0800
+++ b/mercurial/commands.py	Wed Feb 20 11:31:41 2013 -0800
@@ -4215,10 +4215,10 @@
         displayer.show(ctx, copies=copies, matchfn=revmatchfn)
 
     for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
+        if displayer.flush(ctx.rev()):
+            count += 1
         if count == limit:
             break
-        if displayer.flush(ctx.rev()):
-            count += 1
     displayer.close()
 
 @command('manifest',