changeset 25901:0203c50a589f

debugrevspec: pass lookup function to visualize fallback mechanism The next patch will move the exceptional parsing of old-style ranges to revset.tokenize(). This patch will allow us to see the result tree. Note that the parsing result of '-a-b-c-' is incorrect at this changeset. It will be fixed soon.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 18 Jul 2015 23:02:18 +0900
parents c35ee1bbbbdc
children 5214cbdc37e5
files mercurial/commands.py tests/test-revset.t
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Aug 02 19:18:35 2015 +0800
+++ b/mercurial/commands.py	Sat Jul 18 23:02:18 2015 +0900
@@ -2933,7 +2933,7 @@
     expansion.
     """
     if ui.verbose:
-        tree = revset.parse(expr)
+        tree = revset.parse(expr, lookup=repo.__contains__)
         ui.note(revset.prettyformat(tree), "\n")
         newtree = revset.findaliases(ui, tree)
         if newtree != tree:
@@ -2945,7 +2945,7 @@
         if opts["optimize"]:
             weight, optimizedtree = revset.optimize(newtree, True)
             ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
-    func = revset.match(ui, expr)
+    func = revset.match(ui, expr, repo)
     revs = func(repo)
     if ui.verbose:
         ui.note("* set:\n", revset.prettyformatset(revs), "\n")
--- a/tests/test-revset.t	Sun Aug 02 19:18:35 2015 +0800
+++ b/tests/test-revset.t	Sat Jul 18 23:02:18 2015 +0900
@@ -197,10 +197,16 @@
   <filteredset
     <baseset [7]>>
   7
-  $ try -- '-a-b-c-' # complains
-  hg: parse error at 7: not a prefix: end
-  [255]
-  $ log -a-b-c- # succeeds with fallback
+
+names that should be caught by fallback mechanism
+
+  $ try -- '-a-b-c-'
+  (negate
+    ('symbol', 'a-b-c-'))
+  * set:
+  <baseset [4]>
+  4
+  $ log -a-b-c-
   4
 
   $ try -- -a-b-c--a # complains