Mercurial > hg
comparison mercurial/cmdutil.py @ 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 | 39011927fdb0 |
comparison
equal
deleted
inserted
replaced
3525:cf0f8d9256c7 | 3526:68341c06bc61 |
---|---|
47 def revfix(repo, val, defval): | 47 def revfix(repo, val, defval): |
48 if not val and val != 0: | 48 if not val and val != 0: |
49 return defval | 49 return defval |
50 return repo.changelog.rev(repo.lookup(val)) | 50 return repo.changelog.rev(repo.lookup(val)) |
51 | 51 |
52 seen = {} | 52 seen, l = {}, [] |
53 for spec in revs: | 53 for spec in revs: |
54 if revrangesep in spec: | 54 if revrangesep in spec: |
55 start, end = spec.split(revrangesep, 1) | 55 start, end = spec.split(revrangesep, 1) |
56 start = revfix(repo, start, 0) | 56 start = revfix(repo, start, 0) |
57 end = revfix(repo, end, repo.changelog.count() - 1) | 57 end = revfix(repo, end, repo.changelog.count() - 1) |
58 step = start > end and -1 or 1 | 58 step = start > end and -1 or 1 |
59 for rev in xrange(start, end+step, step): | 59 for rev in xrange(start, end+step, step): |
60 if rev in seen: | 60 if rev in seen: |
61 continue | 61 continue |
62 seen[rev] = 1 | 62 seen[rev] = 1 |
63 yield rev | 63 l.append(rev) |
64 else: | 64 else: |
65 rev = revfix(repo, spec, None) | 65 rev = revfix(repo, spec, None) |
66 if rev in seen: | 66 if rev in seen: |
67 continue | 67 continue |
68 seen[rev] = 1 | 68 seen[rev] = 1 |
69 yield rev | 69 l.append(rev) |
70 | |
71 return l | |
70 | 72 |
71 def make_filename(repo, pat, node, | 73 def make_filename(repo, pat, node, |
72 total=None, seqno=None, revwidth=None, pathname=None): | 74 total=None, seqno=None, revwidth=None, pathname=None): |
73 node_expander = { | 75 node_expander = { |
74 'H': lambda: hex(node), | 76 'H': lambda: hex(node), |