# HG changeset patch # User Matt Mackall # Date 2006-12-01 04:38:48 # Node ID ad3d5b4367cb0cfc3c1b19a279db568e9846be02 # Parent 205f0fd4a4a173809dbf3a3e134ecf4d49e6f46c 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 diff --git a/mercurial/commands.py b/mercurial/commands.py --- 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 diff --git a/tests/test-basic b/tests/test-basic --- a/tests/test-basic +++ b/tests/test-basic @@ -7,6 +7,6 @@ echo a > a hg add a hg commit -m test -d "1000000 0" hg history -hg manifest +hg manifest --debug hg cat a hg verify diff --git a/tests/test-empty-file b/tests/test-empty-file --- a/tests/test-empty-file +++ b/tests/test-empty-file @@ -22,4 +22,4 @@ hg merge 1 # empty file that came from rev 1. hg status hg commit -m merge -d '1000000 0' -hg manifest tip +hg manifest --debug tip diff --git a/tests/test-excessive-merge b/tests/test-excessive-merge --- a/tests/test-excessive-merge +++ b/tests/test-excessive-merge @@ -31,13 +31,13 @@ hg debugindex .hg/00changelog.i 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 diff --git a/tests/test-filebranch b/tests/test-filebranch --- a/tests/test-filebranch +++ b/tests/test-filebranch @@ -71,7 +71,7 @@ echo "quux: we shouldn't have a merge he 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 diff --git a/tests/test-git-import b/tests/test-git-import --- a/tests/test-git-import +++ b/tests/test-git-import @@ -161,7 +161,7 @@ rename from foo rename to foo2 EOF cat foo2 -hg manifest | grep binary +hg manifest --debug | grep binary echo % many binary files hg import -m multibinary - < 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 diff --git a/tests/test-simple-update b/tests/test-simple-update --- a/tests/test-simple-update +++ b/tests/test-simple-update @@ -21,4 +21,4 @@ hg pull ../branch hg verify hg co cat foo -hg manifest +hg manifest --debug