getlogrevs: rewrite a loop to get read of try/except
Get rid of the 'except StopIteration' abomination.
--- a/mercurial/cmdutil.py Mon May 18 12:17:08 2015 -0500
+++ b/mercurial/cmdutil.py Mon May 18 12:18:00 2015 -0500
@@ -2127,15 +2127,11 @@
if not opts.get('rev'):
revs.sort(reverse=True)
if limit is not None:
- count = 0
limitedrevs = []
- it = iter(revs)
- while count < limit:
- try:
- limitedrevs.append(it.next())
- except (StopIteration):
+ for idx, r in enumerate(revs):
+ if limit <= idx:
break
- count += 1
+ limitedrevs.append(r)
revs = revset.baseset(limitedrevs)
return revs, expr, filematcher