##// 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,14 +149,10 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:
157 l.append(r)
158 seen.update(l)
159 elif revrangesep in spec:
160 start, end = spec.split(revrangesep, 1)
156 start, end = spec.split(revrangesep, 1)
161 start = revfix(repo, start, 0)
157 start = revfix(repo, start, 0)
162 end = revfix(repo, end, len(repo) - 1)
158 end = revfix(repo, end, len(repo) - 1)
@@ -166,12 +162,22 b' def revrange(repo, revs):'
166 continue
162 continue
167 seen.add(rev)
163 seen.add(rev)
168 l.append(rev)
164 l.append(rev)
169 else:
165 continue
166 elif spec in repo: # single unquoted rev
170 rev = revfix(repo, spec, None)
167 rev = revfix(repo, spec, None)
171 if rev in seen:
168 if rev in seen:
172 continue
169 continue
173 seen.add(rev)
170 seen.add(rev)
174 l.append(rev)
171 l.append(rev)
172 except error.RepoLookupError:
173 pass
174
175 # fall through to new-style queries if old-style fails
176 m = revset.match(spec)
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