changeset 14399:71938479eff9

add new option --all to manifest command prints a list of all files in all revisions of the repo obsoletes the cifiles extension
author Adrian Buehlmann <adrian@cadifra.com>
date Wed, 18 May 2011 21:31:40 +0200
parents ae1f7a5373e8
children cd1ca2556cac
files mercurial/commands.py tests/test-debugcomplete.t tests/test-manifest.t
diffstat 3 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat May 21 02:05:00 2011 +0200
+++ b/mercurial/commands.py	Wed May 18 21:31:40 2011 +0200
@@ -3392,9 +3392,10 @@
     displayer.close()
 
 @command('manifest',
-    [('r', 'rev', '', _('revision to display'), _('REV'))],
+    [('r', 'rev', '', _('revision to display'), _('REV')),
+     ('', 'all', False, _("list files from all revisions"))],
     _('[-r REV]'))
-def manifest(ui, repo, node=None, rev=None):
+def manifest(ui, repo, node=None, rev=None, **opts):
     """output the current or given revision of the project manifest
 
     Print a list of version controlled files for the given revision.
@@ -3404,8 +3405,30 @@
     With -v, print file permissions, symlink and executable bits.
     With --debug, print file revision hashes.
 
+    If option --all is specified, the list of all files from all revisions
+    is printed. This includes deleted and renamed files.
+
     Returns 0 on success.
     """
+    if opts.get('all'):
+        if rev or node:
+            raise util.Abort(_("can't specify a revision with --all"))
+
+        res = []
+        prefix = "data/"
+        suffix = ".i"
+        plen = len(prefix)
+        slen = len(suffix)
+        lock = repo.lock()
+        try:
+            for fn, b, size in repo.store.datafiles():
+                if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
+                    res.append(fn[plen:-slen])
+        finally:
+            lock.release()
+        for f in sorted(res):
+            ui.write("%s\n" % f)
+        return
 
     if rev and node:
         raise util.Abort(_("please specify just one revision"))
--- a/tests/test-debugcomplete.t	Sat May 21 02:05:00 2011 +0200
+++ b/tests/test-debugcomplete.t	Wed May 18 21:31:40 2011 +0200
@@ -246,7 +246,7 @@
   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
   incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   locate: rev, print0, fullpath, include, exclude
-  manifest: rev
+  manifest: rev, all
   outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   parents: rev, style, template
   paths: 
--- a/tests/test-manifest.t	Sat May 21 02:05:00 2011 +0200
+++ b/tests/test-manifest.t	Wed May 18 21:31:40 2011 +0200
@@ -53,6 +53,10 @@
   b/a
   l
 
+  $ hg manifest --all
+  a
+  b/a
+  l
 
 The next two calls are expected to abort: