changeset 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 205f0fd4a4a1
children 9f5c46c50118
files mercurial/commands.py tests/test-basic tests/test-empty-file tests/test-excessive-merge tests/test-filebranch tests/test-git-import tests/test-merge6 tests/test-pull tests/test-rawcommit1 tests/test-simple-update
diffstat 10 files changed, 31 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Nov 30 19:50:28 2006 -0600
+++ b/mercurial/commands.py	Thu Nov 30 22:38:48 2006 -0600
@@ -1513,25 +1513,22 @@
     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
--- a/tests/test-basic	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-basic	Thu Nov 30 22:38:48 2006 -0600
@@ -7,6 +7,6 @@
 hg add a
 hg commit -m test -d "1000000 0"
 hg history
-hg manifest
+hg manifest --debug
 hg cat a
 hg verify
--- a/tests/test-empty-file	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-empty-file	Thu Nov 30 22:38:48 2006 -0600
@@ -22,4 +22,4 @@
 # empty file that came from rev 1.
 hg status
 hg commit -m merge -d '1000000 0'
-hg manifest tip
+hg manifest --debug tip
--- a/tests/test-excessive-merge	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-excessive-merge	Thu Nov 30 22:38:48 2006 -0600
@@ -31,13 +31,13 @@
 echo
 
 echo 1
-hg manifest 1
+hg manifest --debug 1
 echo 2
-hg manifest 2
+hg manifest --debug 2
 echo 3
-hg manifest 3
+hg manifest --debug 3
 echo 4
-hg manifest 4
+hg manifest --debug 4
 
 echo
 
--- a/tests/test-filebranch	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-filebranch	Thu Nov 30 22:38:48 2006 -0600
@@ -71,7 +71,7 @@
 hg debugindex .hg/data/quux.i
 
 echo "manifest entries should match tips of all files"
-hg manifest
+hg manifest --debug
 
 echo "everything should be clean now"
 hg status
--- a/tests/test-git-import	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-git-import	Thu Nov 30 22:38:48 2006 -0600
@@ -161,7 +161,7 @@
 rename to foo2
 EOF
 cat foo2
-hg manifest | grep binary
+hg manifest --debug | grep binary
 
 echo % many binary files
 hg import -m multibinary - <<EOF
@@ -180,4 +180,4 @@
 Mc\${NkU|\`?^000jF3jhEB
 
 EOF
-hg manifest | grep mbinary
+hg manifest --debug | grep mbinary
--- a/tests/test-merge6	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-merge6	Thu Nov 30 22:38:48 2006 -0600
@@ -36,11 +36,11 @@
 hg merge
 hg commit -m "commit test" -d "1000000 0"
 echo bar should remain deleted.
-hg manifest
+hg manifest --debug
 
 cd ../B2
 hg pull ../A2
 hg merge
 hg commit -m "commit test" -d "1000000 0"
 echo bar should remain deleted.
-hg manifest
+hg manifest --debug
--- a/tests/test-pull	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-pull	Thu Nov 30 22:38:48 2006 -0600
@@ -16,5 +16,5 @@
 hg verify
 hg co
 cat foo
-hg manifest
+hg manifest --debug
 hg pull
--- a/tests/test-rawcommit1	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-rawcommit1	Thu Nov 30 22:38:48 2006 -0600
@@ -6,28 +6,28 @@
 echo this is b1 > b
 hg add b
 hg commit -m1 -d "1000000 0"
-hg manifest 1
+hg manifest --debug 1
 echo this is c1 > c
 hg rawcommit -p 1 -d "1000000 0" -m2 c
-hg manifest 2
+hg manifest --debug 2
 hg -v parents
 rm b
 hg rawcommit -p 2 -d "1000000 0" -m3 b
-hg manifest 3
+hg manifest --debug 3
 hg -v parents
 echo this is a22 > a
 hg rawcommit -p 3 -d "1000000 0" -m4 a
-hg manifest 4
+hg manifest --debug 4
 hg -v parents
 echo this is c22 > c
 hg rawcommit -p 1 -d "1000000 0" -m5 c
-hg manifest 5
+hg manifest --debug 5
 hg -v parents
 # merge, but no files changed
 hg rawcommit -p 4 -p 5 -d "1000000 0" -m6
-hg manifest 6
+hg manifest --debug 6
 hg -v parents
 # no changes what-so-ever
 hg rawcommit -p 6 -d "1000000 0" -m7
-hg manifest 7
+hg manifest --debug 7
 hg -v parents
--- a/tests/test-simple-update	Thu Nov 30 19:50:28 2006 -0600
+++ b/tests/test-simple-update	Thu Nov 30 22:38:48 2006 -0600
@@ -21,4 +21,4 @@
 hg verify
 hg co
 cat foo
-hg manifest
+hg manifest --debug