Show More
@@ -2210,7 +2210,7 b' def debugrevspec(ui, repo, expr, **opts)' | |||||
2210 |
|
2210 | |||
2211 | treebystage = {} |
|
2211 | treebystage = {} | |
2212 | printedtree = None |
|
2212 | printedtree = None | |
2213 |
tree = revsetlang.parse(expr, lookup=repo |
|
2213 | tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo)) | |
2214 | for n, f in stages: |
|
2214 | for n, f in stages: | |
2215 | treebystage[n] = tree = f(tree) |
|
2215 | treebystage[n] = tree = f(tree) | |
2216 | if n in showalways or (n in showchanged and tree != printedtree): |
|
2216 | if n in showalways or (n in showchanged and tree != printedtree): |
@@ -2170,6 +2170,9 b' def posttreebuilthook(tree, repo):' | |||||
2170 | # hook for extensions to execute code on the optimized tree |
|
2170 | # hook for extensions to execute code on the optimized tree | |
2171 | pass |
|
2171 | pass | |
2172 |
|
2172 | |||
|
2173 | def lookupfn(repo): | |||
|
2174 | return lambda symbol: scmutil.isrevsymbol(repo, symbol) | |||
|
2175 | ||||
2173 | def match(ui, spec, repo=None): |
|
2176 | def match(ui, spec, repo=None): | |
2174 | """Create a matcher for a single revision spec""" |
|
2177 | """Create a matcher for a single revision spec""" | |
2175 | return matchany(ui, [spec], repo=repo) |
|
2178 | return matchany(ui, [spec], repo=repo) | |
@@ -2189,7 +2192,7 b' def matchany(ui, specs, repo=None, local' | |||||
2189 | raise error.ParseError(_("empty query")) |
|
2192 | raise error.ParseError(_("empty query")) | |
2190 | lookup = None |
|
2193 | lookup = None | |
2191 | if repo: |
|
2194 | if repo: | |
2192 |
lookup = repo |
|
2195 | lookup = lookupfn(repo) | |
2193 | if len(specs) == 1: |
|
2196 | if len(specs) == 1: | |
2194 | tree = revsetlang.parse(specs[0], lookup) |
|
2197 | tree = revsetlang.parse(specs[0], lookup) | |
2195 | else: |
|
2198 | else: |
@@ -433,6 +433,13 b' def formatrevnode(ui, rev, node):' | |||||
433 | hexfunc = short |
|
433 | hexfunc = short | |
434 | return '%d:%s' % (rev, hexfunc(node)) |
|
434 | return '%d:%s' % (rev, hexfunc(node)) | |
435 |
|
435 | |||
|
436 | def isrevsymbol(repo, symbol): | |||
|
437 | try: | |||
|
438 | revsymbol(repo, symbol) | |||
|
439 | return True | |||
|
440 | except error.RepoLookupError: | |||
|
441 | return False | |||
|
442 | ||||
436 | def revsymbol(repo, symbol): |
|
443 | def revsymbol(repo, symbol): | |
437 | """Returns a context given a single revision symbol (as string). |
|
444 | """Returns a context given a single revision symbol (as string). | |
438 |
|
445 |
@@ -54,7 +54,7 b" these predicates use '\\0' as a separator" | |||||
54 | > args = map(nodemod.bin, args) |
|
54 | > args = map(nodemod.bin, args) | |
55 | > expr = revsetlang.formatspec(fmt, list(args)) |
|
55 | > expr = revsetlang.formatspec(fmt, list(args)) | |
56 | > if ui.verbose: |
|
56 | > if ui.verbose: | |
57 |
> tree = revsetlang.parse(expr, lookup=repo |
|
57 | > tree = revsetlang.parse(expr, lookup=revset.lookupfn(repo)) | |
58 | > ui.note(revsetlang.prettyformat(tree), b"\n") |
|
58 | > ui.note(revsetlang.prettyformat(tree), b"\n") | |
59 | > if opts["optimize"]: |
|
59 | > if opts["optimize"]: | |
60 | > opttree = revsetlang.optimize(revsetlang.analyze(tree)) |
|
60 | > opttree = revsetlang.optimize(revsetlang.analyze(tree)) |
General Comments 0
You need to be logged in to leave comments.
Login now