Mercurial > hg-stable
changeset 5230:bfd73b567b3d
When reverting a file which was renamed, also revert the old name
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 29 Aug 2007 16:15:23 -0700 |
parents | dee573ba79f1 |
children | 5c2ca6d6ab21 d59ed18ec2d0 |
files | mercurial/commands.py tests/test-revert tests/test-revert.out |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Aug 27 14:21:04 2007 -0300 +++ b/mercurial/commands.py Wed Aug 29 16:15:23 2007 -0700 @@ -2338,6 +2338,14 @@ changes = repo.status(match=names.has_key, wlock=wlock)[:5] modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) + # if f is a rename, also revert the source + cwd = repo.getcwd() + for f in added: + src = repo.dirstate.copied(f) + if src and src not in names and repo.dirstate[src][0] == 'r': + removed[src] = None + names[src] = (repo.pathto(src, cwd), True) + revert = ([], _('reverting %s\n')) add = ([], _('adding %s\n')) remove = ([], _('removing %s\n'))