changeset 17370:3fe199579323 stable

debugfileset: implement --rev, more tests
author Patrick Mezard <patrick@mezard.eu>
date Wed, 15 Aug 2012 22:28:32 +0200
parents b360011a132d
children 1310489eb5d6
files mercurial/commands.py tests/test-debugcomplete.t tests/test-fileset.t
diffstat 3 files changed, 56 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Aug 15 22:09:09 2012 +0200
+++ b/mercurial/commands.py	Wed Aug 15 22:28:32 2012 +0200
@@ -1847,14 +1847,17 @@
         localrevs = opts.get('local_head')
         doit(localrevs, remoterevs)
 
-@command('debugfileset', [], ('REVSPEC'))
-def debugfileset(ui, repo, expr):
+@command('debugfileset',
+    [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
+    _('[-r REV] FILESPEC'))
+def debugfileset(ui, repo, expr, **opts):
     '''parse and apply a fileset specification'''
+    ctx = scmutil.revsingle(repo, opts.get('rev'), None)
     if ui.verbose:
         tree = fileset.parse(expr)[0]
         ui.note(tree, "\n")
 
-    for f in fileset.getfileset(repo[None], expr):
+    for f in fileset.getfileset(ctx, expr):
         ui.write("%s\n" % f)
 
 @command('debugfsinfo', [], _('[PATH]'))
--- a/tests/test-debugcomplete.t	Wed Aug 15 22:09:09 2012 +0200
+++ b/tests/test-debugcomplete.t	Wed Aug 15 22:28:32 2012 +0200
@@ -229,7 +229,7 @@
   debugdata: changelog, manifest
   debugdate: extended
   debugdiscovery: old, nonheads, ssh, remotecmd, insecure
-  debugfileset: 
+  debugfileset: rev
   debugfsinfo: 
   debuggetbundle: head, common, type
   debugignore: 
--- a/tests/test-fileset.t	Wed Aug 15 22:09:09 2012 +0200
+++ b/tests/test-fileset.t	Wed Aug 15 22:28:32 2012 +0200
@@ -173,4 +173,53 @@
   sub
   $ fileset 'subrepo("glob:*")'
   sub
+  $ hg ci -m subrepo
 
+Test with a revision
+
+  $ hg log -G --template '{rev} {desc}\n'
+  @  4 subrepo
+  |
+  o    3 merge
+  |\
+  | o  2 diverging
+  | |
+  o |  1 manychanges
+  |/
+  o  0 addfiles
+  
+  $ echo unknown > unknown
+  $ fileset -r1 'modified()'
+  b2
+  $ fileset -r1 'added() and c1'
+  c1
+  $ fileset -r1 'removed()'
+  a2
+  $ fileset -r1 'deleted()'
+  $ fileset -r1 'unknown()'
+  $ fileset -r1 'ignored()'
+  $ fileset -r1 'hgignore()'
+  b2
+  bin
+  $ fileset -r1 'binary()'
+  bin
+  $ fileset -r1 'size(1k)'
+  1k
+  $ fileset -r3 'resolved()'
+  $ fileset -r3 'unresolved()'
+
+#if execbit
+  $ fileset -r1 'exec()'
+  b2
+#endif
+
+#if symlink
+  $ fileset -r1 'symlink()'
+  b2link
+#endif
+
+  $ fileset -r4 'subrepo("re:su.*")'
+  sub
+  $ fileset -r4 'subrepo("sub")'
+  sub
+