changeset 5155:13d23d66a6cd

manifest: accept -r for rev specification
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 09 Aug 2007 19:42:33 -0700
parents 67afecb8d6cc
children 49554ba98951
files mercurial/commands.py tests/test-manifest tests/test-manifest.out
diffstat 3 files changed, 48 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 09 17:29:16 2007 -0700
+++ b/mercurial/commands.py	Thu Aug 09 19:42:33 2007 -0700
@@ -1870,7 +1870,7 @@
             if displayer.flush(rev):
                 count += 1
 
-def manifest(ui, repo, rev=None):
+def manifest(ui, repo, node=None, rev=None):
     """output the current or given revision of the project manifest
 
     Print a list of version controlled files for the given revision.
@@ -1884,7 +1884,13 @@
     file revision hashes.
     """
 
-    m = repo.changectx(rev).manifest()
+    if rev and node:
+        raise util.Abort(_("please specify just one revision"))
+
+    if not node:
+        node = rev
+
+    m = repo.changectx(node).manifest()
     files = m.keys()
     files.sort()
 
@@ -1911,7 +1917,6 @@
 
     if rev and node:
         raise util.Abort(_("please specify just one revision"))
-
     if not node:
         node = rev
 
@@ -2979,7 +2984,8 @@
           ('', 'template', '', _('display with template')),
          ] + walkopts,
          _('hg log [OPTION]... [FILE]')),
-    "manifest": (manifest, [], _('hg manifest [REV]')),
+    "manifest": (manifest, [('r', 'rev', '', _('revision to display'))],
+                 _('hg manifest [-r REV]')),
     "^merge":
         (merge,
          [('f', 'force', None, _('force a merge with outstanding changes')),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-manifest	Thu Aug 09 19:42:33 2007 -0700
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+hg init
+echo a > a
+hg ci -Ama -d'0 0'
+mkdir b
+echo a > b/a
+hg ci -Amb -d'1 0'
+hg manifest
+hg manifest -v
+hg manifest --debug
+hg manifest -r 0
+hg manifest -r 1
+hg manifest -r tip
+
+echo % should fail
+hg manifest -r 2
+hg manifest -r tip tip
+
+hg manifest tip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-manifest.out	Thu Aug 09 19:42:33 2007 -0700
@@ -0,0 +1,18 @@
+adding a
+adding b/a
+a
+b/a
+644 a
+644 b/a
+b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a
+b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 b/a
+a
+a
+b/a
+a
+b/a
+% should fail
+abort: unknown revision '2'!
+abort: please specify just one revision
+a
+b/a