Mercurial > hg
changeset 25147:fb7b9a765bb9
walkchangerevs: replace try/except with 'next'
Again, this make the code clearer.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sun, 17 May 2015 18:11:02 -0700 |
parents | f542a2c89b60 |
children | 3b5cd6f13dcc |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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)