# HG changeset patch # User mpm@selenic.com # Date 2005-07-03 04:51:33 # Node ID 38d106db75bc5b267463482d5720020367dd2b85 # Parent 4be4d458046741c8767368b441485faeb7519d6a 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----- diff --git a/mercurial/commands.py b/mercurial/commands.py --- 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: