Mercurial > hg
changeset 3526:68341c06bc61
Make revrange return a list of ints so that callers don't have to convert
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Oct 2006 17:27:07 -0500 |
parents | cf0f8d9256c7 |
children | 45620faafa28 |
files | hgext/mq.py mercurial/cmdutil.py mercurial/commands.py |
diffstat | 3 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Thu Oct 26 17:15:55 2006 -0500 +++ b/hgext/mq.py Thu Oct 26 17:27:07 2006 -0500 @@ -502,7 +502,7 @@ if opts.get('rev'): if not self.applied: raise util.Abort(_('no patches applied')) - revs = [int(r) for r in cmdutil.revrange(ui, repo, opts['rev'])] + revs = cmdutil.revrange(ui, repo, opts['rev']) if len(revs) > 1 and revs[0] > revs[1]: revs.reverse() for rev in revs: @@ -1276,7 +1276,7 @@ if files: raise util.Abort(_('option "-r" not valid when importing ' 'files')) - rev = [int(r) for r in cmdutil.revrange(self.ui, repo, rev)] + rev = cmdutil.revrange(self.ui, repo, rev) rev.sort(lambda x, y: cmp(y, x)) if (len(files) > 1 or len(rev) > 1) and patchname: raise util.Abort(_('option "-n" not valid when importing multiple '
--- a/mercurial/cmdutil.py Thu Oct 26 17:15:55 2006 -0500 +++ b/mercurial/cmdutil.py Thu Oct 26 17:27:07 2006 -0500 @@ -49,7 +49,7 @@ return defval return repo.changelog.rev(repo.lookup(val)) - seen = {} + seen, l = {}, [] for spec in revs: if revrangesep in spec: start, end = spec.split(revrangesep, 1) @@ -60,13 +60,15 @@ if rev in seen: continue seen[rev] = 1 - yield rev + l.append(rev) else: rev = revfix(repo, spec, None) if rev in seen: continue seen[rev] = 1 - yield rev + l.append(rev) + + return l def make_filename(repo, pat, node, total=None, seqno=None, revwidth=None, pathname=None):
--- a/mercurial/commands.py Thu Oct 26 17:15:55 2006 -0500 +++ b/mercurial/commands.py Thu Oct 26 17:27:07 2006 -0500 @@ -102,7 +102,7 @@ defrange = '%s:0' % repo.changectx().rev() else: defrange = 'tip:0' - revs = map(int, cmdutil.revrange(ui, repo, opts['rev'] or [defrange])) + revs = cmdutil.revrange(ui, repo, opts['rev'] or [defrange]) wanted = {} slowpath = anypats fncache = {} @@ -1375,7 +1375,7 @@ """ if not changesets: raise util.Abort(_("export requires at least one changeset")) - revs = list(cmdutil.revrange(ui, repo, changesets)) + revs = cmdutil.revrange(ui, repo, changesets) if len(revs) > 1: ui.note(_('exporting patches:\n')) else: @@ -1841,8 +1841,7 @@ count = 0 if opts['copies'] and opts['rev']: - endrev = max([int(i) - for i in cmdutil.revrange(ui, repo, opts['rev'])]) + 1 + endrev = max(cmdutil.revrange(ui, repo, opts['rev'])) + 1 else: endrev = repo.changelog.count() rcache = {}