##// END OF EJS Templates
revrange: attempt to parse old-style queries as a first pass
Matt Mackall -
r11405:bf5d88c4 default
parent child Browse files
Show More
@@ -149,29 +149,35 b' def revrange(repo, revs):'
149
149
150 seen, l = set(), []
150 seen, l = set(), []
151 for spec in revs:
151 for spec in revs:
152 if spec and not (
152 # attempt to parse old-style ranges first to deal with
153 spec.startswith(revrangesep) or spec.endswith(revrangesep)):
153 # things like old-tag which contain query metacharacters
154 m = revset.match(spec)
154 try:
155 for r in m(repo, range(len(repo))):
155 if revrangesep in spec:
156 if r not in seen:
156 start, end = spec.split(revrangesep, 1)
157 l.append(r)
157 start = revfix(repo, start, 0)
158 seen.update(l)
158 end = revfix(repo, end, len(repo) - 1)
159 elif revrangesep in spec:
159 step = start > end and -1 or 1
160 start, end = spec.split(revrangesep, 1)
160 for rev in xrange(start, end + step, step):
161 start = revfix(repo, start, 0)
161 if rev in seen:
162 end = revfix(repo, end, len(repo) - 1)
162 continue
163 step = start > end and -1 or 1
163 seen.add(rev)
164 for rev in xrange(start, end + step, step):
164 l.append(rev)
165 continue
166 elif spec in repo: # single unquoted rev
167 rev = revfix(repo, spec, None)
165 if rev in seen:
168 if rev in seen:
166 continue
169 continue
167 seen.add(rev)
170 seen.add(rev)
168 l.append(rev)
171 l.append(rev)
169 else:
172 except error.RepoLookupError:
170 rev = revfix(repo, spec, None)
173 pass
171 if rev in seen:
174
172 continue
175 # fall through to new-style queries if old-style fails
173 seen.add(rev)
176 m = revset.match(spec)
174 l.append(rev)
177 for r in m(repo, range(len(repo))):
178 if r not in seen:
179 l.append(r)
180 seen.update(l)
175
181
176 return l
182 return l
177
183
@@ -269,7 +269,7 b' diff --git a/b1 b/b1'
269 +postm
269 +postm
270
270
271 % log -r ""
271 % log -r ""
272 abort: 00changelog.i@: ambiguous identifier!
272 hg: parse error: empty query
273 % log -r <some unknown node id>
273 % log -r <some unknown node id>
274 abort: unknown revision '1000000000000000000000000000000000000000'!
274 abort: unknown revision '1000000000000000000000000000000000000000'!
275 % log -k r1
275 % log -k r1
General Comments 0
You need to be logged in to leave comments. Login now