Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 227:f57519cddd3d
move repo.current to dirstate.parents()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
move repo.current to dirstate.parents()
dirstate now tracks the parents for the working dir
add a parents command to show them
manifest hash: cd69237838c3f69f7937723c4a6803d47cb27cfa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCoMGuywK+sNU5EO8RAg5UAKCVLUrsJtkoIOTM+e0BLqEVN3Ni3gCeNDyy
ZF8jD728cl9K7S4sIN4gX4Y=
=P4bu
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Fri, 03 Jun 2005 12:46:38 -0800 |
parents | 2bfe525ef6ca |
children | 00ea3613f82c |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Jun 03 12:45:04 2005 -0800 +++ b/mercurial/commands.py Fri Jun 03 12:46:38 2005 -0800 @@ -102,7 +102,7 @@ ops['number'] = 1 args = relpath(repo, args) - node = repo.current + node = repo.dirstate.parents()[0] if ops['revision']: node = repo.changelog.lookup(ops['revision']) change = repo.changelog.read(node) @@ -142,6 +142,17 @@ print "description:" print changes[4] +def parents(ui, repo, node = None): + '''show the parents of the current working dir''' + if node: + p = repo.changelog.parents(repo.lookup(hg.bin(node))) + else: + p = repo.dirstate.parents() + + for n in p: + if n != hg.nullid: + ui.write("%d:%s\n" % (repo.changelog.rev(n), hg.hex(n))) + def status(ui, repo): '''show changed files in the working directory @@ -172,6 +183,7 @@ ('n', 'number', None, 'show revision number'), ('c', 'changeset', None, 'show changeset')], 'hg annotate [-u] [-c] [-n] [-r id] [files]'), + "parents": (parents, [], 'hg parents [node]'), "status": (status, [], 'hg status'), "undo": (undo, [], 'hg undo'), }