Mercurial > hg-stable
changeset 1066:ea878688221e
Shortened commands.revrange() a little bit, added docstring.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 26 Aug 2005 15:26:44 +0200 |
parents | 6e94c0365d98 |
children | fae1204603dc |
files | mercurial/commands.py |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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))