Force hg revert to delete instead of reverting

Martin Geisler mg at lazybytes.net
Sun May 3 13:50:20 CDT 2009


Henri Wiechers <hwiechers at gmail.com> writes:

> I'm using mercurial 1.2.1 on Windows.
>
> Sometimes I revert back to an revision (say x) to check some stuff and
> then revert back to the tip.
> I've noticed that when reverting back to tip that revert doesn't
> delete files removed between x
> and tip, instead it forgets them. Is there anyway to get revert to
> delete them instead? I couldn't find a
> switch for this.

Are you using 'hg revert' to look at the old revisions?

If so, then please don't -- use 'hg update' instead. Your working
directory will always reflect the content of a particular changeset.
This is called the 'parent changeset' of the working directory. You
change this with 'hg update'.

With 'hg revert' you change the content of a single file (or many files)
to reflect the content at a particular changeset. But you do not change
the working directory parent changeset.

When you do 'hg revert -r x --all', deleted files in revision 'x' are
resurrected and scheduled for addition. When you do 'hg revert -r tip
--all' you will make Mercurial put the content from the 'tip' changeset
back into all files. The resurrected file is not present in 'tip' and
will be left alone, and hence show up in 'hg status' as unknown.

If you use 'hg update' instead you will see that the file is resurrected
and deleted as expected.

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20090503/f9f51c64/attachment.pgp 


More information about the Mercurial mailing list