# HG changeset patch # User Pierre-Yves David # Date 1431911462 25200 # Node ID fb7b9a765bb9fe6e2e9cc05493f77ba02359fa66 # Parent f542a2c89b60b869608ac1ba6225756031c217db walkchangerevs: replace try/except with 'next' Again, this make the code clearer. diff -r f542a2c89b60 -r fb7b9a765bb9 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)