Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 221:2bfe525ef6ca
Beginning of multi-head support
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Beginning of multi-head support
Add revlog.heads()
Add heads command to list changeset heads
manifest hash: 50df6fffe59a40c19782e2c77c8077db026fde67
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCn7tFywK+sNU5EO8RAusWAJ9EojIxgqEEt8VZd5S+5Laj8tHV+ACfWLb5
TC7AnsoFGg50jAWF0EsofDA=
=nzyH
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Thu, 02 Jun 2005 18:07:01 -0800 |
parents | 3113a94c1bff |
children | f57519cddd3d |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jun 02 17:39:29 2005 -0800 +++ b/mercurial/commands.py Thu Jun 02 18:07:01 2005 -0800 @@ -1,4 +1,4 @@ -import os, re, traceback, sys, signal +import os, re, traceback, sys, signal, time from mercurial import fancyopts, ui, hg class UnknownCommand(Exception): pass @@ -122,6 +122,26 @@ for p,l in zip(zip(*pieces), lines): u.write(" ".join(p) + ": " + l[1]) +def heads(ui, repo): + '''show current repository heads''' + for n in repo.changelog.heads(): + i = repo.changelog.rev(n) + changes = repo.changelog.read(n) + (p1, p2) = repo.changelog.parents(n) + (h, h1, h2) = map(hg.hex, (n, p1, p2)) + (i1, i2) = map(repo.changelog.rev, (p1, p2)) + print "rev: %4d:%s" % (i, h) + print "parents: %4d:%s" % (i1, h1) + if i2: print " %4d:%s" % (i2, h2) + print "manifest: %4d:%s" % (repo.manifest.rev(changes[0]), + hg.hex(changes[0])) + print "user:", changes[1] + print "date:", time.asctime( + time.localtime(float(changes[2].split(' ')[0]))) + if ui.verbose: print "files:", " ".join(changes[3]) + print "description:" + print changes[4] + def status(ui, repo): '''show changed files in the working directory @@ -143,6 +163,7 @@ table = { "init": (init, [], 'hg init'), "branch|clone": (branch, [], 'hg branch [path]'), + "heads": (heads, [], 'hg heads'), "help": (help, [], 'hg help [command]'), "checkout|co": (checkout, [], 'hg checkout [changeset]'), "ann|annotate": (annotate,