diff mercurial/commands.py @ 590:38d106db75bc

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-----
author mpm@selenic.com
date Sat, 02 Jul 2005 20:51:33 -0800
parents 0c3bae18403b
children eb46971fc57f
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -735,8 +735,10 @@ def remove(ui, repo, file, *files):
 
 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 @@ def revert(ui, repo, *names, **opts):
             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: