# HG changeset patch # User Thomas Arendsen Hein # Date 1125062804 -7200 # Node ID ea878688221e739b94d13847a9a12a36ab31a15f # Parent 6e94c0365d98be26563e30abbf27b50d655b0403 Shortened commands.revrange() a little bit, added docstring. diff -r 6e94c0365d98 -r ea878688221e mercurial/commands.py --- a/mercurial/commands.py Fri Aug 26 15:19:18 2005 +0200 +++ b/mercurial/commands.py Fri Aug 26 15:26:44 2005 +0200 @@ -125,6 +125,7 @@ revrangesep = ':' def revrange(ui, repo, revs, revlog=None): + """Yield revision as strings from a list of revision specifications.""" if revlog is None: revlog = repo.changelog revcount = revlog.count() @@ -153,13 +154,8 @@ start, end = spec.split(revrangesep, 1) start = fix(start, 0) end = fix(end, revcount - 1) - if end > start: - end += 1 - step = 1 - else: - end -= 1 - step = -1 - for rev in xrange(start, end, step): + step = start > end and -1 or 1 + for rev in xrange(start, end+step, step): yield str(rev) else: yield str(fix(spec, None))