Mercurial > hg-stable
changeset 10687:583adcf63f80
mq: use xrange/enumerate instead of += 1
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 14 Mar 2010 14:53:20 +0100 |
parents | 0c68c2c36ed8 |
children | d4d3a8a65248 |
files | hgext/mq.py |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sun Mar 14 14:45:01 2010 +0100 +++ b/hgext/mq.py Sun Mar 14 14:53:20 2010 +0100 @@ -1564,15 +1564,13 @@ """ end = 0 def next(start): - if all_patches: + if all_patches or start >= len(self.series): return start - i = start - while i < len(self.series): + for i in xrange(start, len(self.series)): p, reason = self.pushable(i) if p: break self.explain_pushable(i) - i += 1 return i if self.applied: p = self.applied[-1].name @@ -1611,7 +1609,6 @@ if (len(files) > 1 or len(rev) > 1) and patchname: raise util.Abort(_('option "-n" not valid when importing multiple ' 'patches')) - i = 0 added = [] if rev: # If mq patches are applied, we can only import revisions @@ -1667,7 +1664,7 @@ self.parse_series() self.applied_dirty = 1 - for filename in files: + for i, filename in enumerate(files): if existing: if filename == '-': raise util.Abort(_('-e is incompatible with import from -')) @@ -1700,7 +1697,6 @@ self.full_series[index:index] = [patchname] self.parse_series() self.ui.warn(_("adding %s to series file\n") % patchname) - i += 1 added.append(patchname) patchname = None self.series_dirty = 1