diff mercurial/commands.py @ 3736:ad3d5b4367cb

make manifest friendlier switch to using context code ..which uses first parent by default show file hashes only with debug switch show permissions with verbose fix up tests
author Matt Mackall <mpm@selenic.com>
date Thu, 30 Nov 2006 22:38:48 -0600
parents 67f44b825784
children 1861fa38a6a7
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1513,25 +1513,22 @@ def manifest(ui, repo, rev=None):
     Print a list of version controlled files for the given revision.
 
     The manifest is the list of files being version controlled. If no revision
-    is given then the tip is used.
+    is given then the first parent of the working directory is used.
+
+    With -v flag, print file permissions. With --debug flag, print
+    file revision hashes.
     """
-    if rev:
-        try:
-            # assume all revision numbers are for changesets
-            n = repo.lookup(rev)
-            change = repo.changelog.read(n)
-            n = change[0]
-        except hg.RepoError:
-            n = repo.manifest.lookup(rev)
-    else:
-        n = repo.manifest.tip()
-    m = repo.manifest.read(n)
+
+    m = repo.changectx(rev).manifest()
     files = m.keys()
     files.sort()
 
     for f in files:
-        ui.write("%40s %3s %s\n" % (hex(m[f]),
-                                    m.execf(f) and "755" or "644", f))
+        if ui.debugflag:
+            ui.write("%40s " % hex(m[f]))
+        if ui.verbose:
+            ui.write("%3s " % (m.execf(f) and "755" or "644"))
+        ui.write("%s\n" % f)
 
 def merge(ui, repo, node=None, force=None, branch=None):
     """Merge working directory with another revision