##// 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 150 seen, l = set(), []
151 151 for spec in revs:
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 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)
161 start = revfix(repo, start, 0)
162 end = revfix(repo, end, len(repo) - 1)
163 step = start > end and -1 or 1
164 for rev in xrange(start, end + step, step):
152 # attempt to parse old-style ranges first to deal with
153 # things like old-tag which contain query metacharacters
154 try:
155 if revrangesep in spec:
156 start, end = spec.split(revrangesep, 1)
157 start = revfix(repo, start, 0)
158 end = revfix(repo, end, len(repo) - 1)
159 step = start > end and -1 or 1
160 for rev in xrange(start, end + step, step):
161 if rev in seen:
162 continue
163 seen.add(rev)
164 l.append(rev)
165 continue
166 elif spec in repo: # single unquoted rev
167 rev = revfix(repo, spec, None)
165 168 if rev in seen:
166 169 continue
167 170 seen.add(rev)
168 171 l.append(rev)
169 else:
170 rev = revfix(repo, spec, None)
171 if rev in seen:
172 continue
173 seen.add(rev)
174 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 182 return l
177 183
@@ -269,7 +269,7 b' diff --git a/b1 b/b1'
269 269 +postm
270 270
271 271 % log -r ""
272 abort: 00changelog.i@: ambiguous identifier!
272 hg: parse error: empty query
273 273 % log -r <some unknown node id>
274 274 abort: unknown revision '1000000000000000000000000000000000000000'!
275 275 % log -k r1
General Comments 0
You need to be logged in to leave comments. Login now