hg revert should revert to parent, not to tip
authormpm@selenic.com
Sat, 02 Jul 2005 20:51:33 -0800
changeset 590 38d106db75bc
parent 589 4be4d4580467
child 591 eb46971fc57f
hg revert should revert to parent, not to tip -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg revert should revert to parent, not to tip manifest hash: b6b622d0316f9f7ef60e500fb73844a4b0ad7b69 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCx27VywK+sNU5EO8RAnpHAKC1H3GAPC5wYlgpJG7Z7rWPl+vblQCeKVsz UCjkaDw40evLbltWoY24xQs= =dmvS -----END PGP SIGNATURE-----
mercurial/commands.py
--- a/mercurial/commands.py	Sat Jul 02 19:57:47 2005 -0800
+++ b/mercurial/commands.py	Sat Jul 02 20:51:33 2005 -0800
@@ -735,8 +735,10 @@
 
 def revert(ui, repo, *names, **opts):
     """revert modified files or dirs back to their unmodified states"""
-    node = opts['rev'] and repo.lookup(opts['rev']) or repo.changelog.tip()
+    node = opts['rev'] and repo.lookup(opts['rev']) or \
+           repo.dirstate.parents()[0]
     root = os.path.realpath(repo.root)
+
     def trimpath(p):
         p = os.path.realpath(p)
         if p.startswith(root):
@@ -746,8 +748,10 @@
             if p.startswith(os.sep):
                 return rest[1:]
             return p
+
     relnames = map(trimpath, names or [os.getcwd()])
     chosen = {}
+
     def choose(name):
         def body(name):
             for r in relnames: