revset: add a debugrevspec command
authorMatt Mackall <mpm@selenic.com>
Tue, 01 Jun 2010 11:18:57 -0500
changeset 11276 f28b58e35768
parent 11275 c9ce8ecd6ca1
child 11277 2698a95f3f1b
revset: add a debugrevspec command
mercurial/commands.py
tests/test-debugcomplete.out
--- a/mercurial/commands.py	Tue Jun 01 11:18:57 2010 -0500
+++ b/mercurial/commands.py	Tue Jun 01 11:18:57 2010 -0500
@@ -13,7 +13,7 @@
 import patch, help, mdiff, url, encoding, templatekw
 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
 import merge as mergemod
-import minirst
+import minirst, revset
 
 # Commands start here, listed alphabetically
 
@@ -936,6 +936,15 @@
                      ui.configsource(section, name, untrusted))
             ui.write('%s=%s\n' % (sectname, value))
 
+def debugrevspec(ui, repo, expr):
+    '''parse and apply a revision specification'''
+    if ui.verbose:
+        tree = revset.parse(expr)
+        ui.note(tree, "\n")
+    func = revset.match(expr)
+    for c in func(repo, range(len(repo))):
+        ui.write("%s\n" % c)
+
 def debugsetparents(ui, repo, rev1, rev2=None):
     """manually set the parents of the current working directory
 
@@ -3782,6 +3791,8 @@
         (debugrename,
          [('r', 'rev', '', _('revision to debug'))],
          _('[-r REV] FILE')),
+    "debugrevspec":
+        (debugrevspec, [], ('REVSPEC')),
     "debugsetparents":
         (debugsetparents, [], _('REV1 [REV2]')),
     "debugstate":
--- a/tests/test-debugcomplete.out	Tue Jun 01 11:18:57 2010 -0500
+++ b/tests/test-debugcomplete.out	Tue Jun 01 11:18:57 2010 -0500
@@ -73,6 +73,7 @@
 debuginstall
 debugrebuildstate
 debugrename
+debugrevspec
 debugsetparents
 debugstate
 debugsub
@@ -201,6 +202,7 @@
 debuginstall: 
 debugrebuildstate: rev
 debugrename: rev
+debugrevspec: 
 debugsetparents: 
 debugstate: nodates
 debugsub: rev