Mercurial > hg
comparison mercurial/cmdutil.py @ 11277:2698a95f3f1b
revset: hook into revrange
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 01 Jun 2010 11:18:57 -0500 |
parents | d1908cb95a82 |
children | b724b8467b82 |
comparison
equal
deleted
inserted
replaced
11276:f28b58e35768 | 11277:2698a95f3f1b |
---|---|
8 from node import hex, nullid, nullrev, short | 8 from node import hex, nullid, nullrev, short |
9 from i18n import _ | 9 from i18n import _ |
10 import os, sys, errno, re, glob, tempfile | 10 import os, sys, errno, re, glob, tempfile |
11 import util, templater, patch, error, encoding, templatekw | 11 import util, templater, patch, error, encoding, templatekw |
12 import match as _match | 12 import match as _match |
13 import similar | 13 import similar, revset |
14 | 14 |
15 revrangesep = ':' | 15 revrangesep = ':' |
16 | 16 |
17 def parsealiases(cmd): | 17 def parsealiases(cmd): |
18 return cmd.lstrip("^").split("|") | 18 return cmd.lstrip("^").split("|") |
147 return defval | 147 return defval |
148 return repo.changelog.rev(repo.lookup(val)) | 148 return repo.changelog.rev(repo.lookup(val)) |
149 | 149 |
150 seen, l = set(), [] | 150 seen, l = set(), [] |
151 for spec in revs: | 151 for spec in revs: |
152 if revrangesep in spec: | 152 if spec and not ( |
153 spec.startswith(revrangesep) or spec.endswith(revrangesep)): | |
154 m = revset.match(spec) | |
155 for r in m(repo, range(len(repo))): | |
156 l.append(r) | |
157 seen.update(l) | |
158 elif revrangesep in spec: | |
153 start, end = spec.split(revrangesep, 1) | 159 start, end = spec.split(revrangesep, 1) |
154 start = revfix(repo, start, 0) | 160 start = revfix(repo, start, 0) |
155 end = revfix(repo, end, len(repo) - 1) | 161 end = revfix(repo, end, len(repo) - 1) |
156 step = start > end and -1 or 1 | 162 step = start > end and -1 or 1 |
157 for rev in xrange(start, end + step, step): | 163 for rev in xrange(start, end + step, step): |