walkchangerevs: replace try/except with 'next'
authorPierre-Yves David <pierre-yves.david@fb.com>
Sun, 17 May 2015 18:11:02 -0700
changeset 25147 fb7b9a765bb9
parent 25146 f542a2c89b60
child 25148 3b5cd6f13dcc
walkchangerevs: replace try/except with 'next' Again, this make the code clearer.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sun May 17 18:06:09 2015 -0700
+++ b/mercurial/cmdutil.py	Sun May 17 18:11:02 2015 -0700
@@ -1843,13 +1843,12 @@
         for windowsize in increasingwindows():
             nrevs = []
             for i in xrange(windowsize):
-                try:
-                    rev = it.next()
-                    if want(rev):
-                        nrevs.append(rev)
-                except (StopIteration):
+                rev = next(it, None)
+                if rev is None:
                     stopiteration = True
                     break
+                elif want(rev):
+                    nrevs.append(rev)
             for rev in sorted(nrevs):
                 fns = fncache.get(rev)
                 ctx = change(rev)