obliterate functionality?

Martin Geisler mg at daimi.au.dk
Tue Mar 18 14:28:20 CDT 2008

cowwoc <cowwoc at bbs.darktech.org> writes:


> How does one permanently remove a file in Mercurial (aka
> "obliterate")? CVS had this, SVN does not and I'm wondering how
> Mercurial stacks up.

As others have told you, then this is not possible if other people have
already pulled from the repository -- they now have their own copy of
the data you want to delete, and there is nothing you can do to make
them delete it!

But if you have your own local repository (since Mercurial is
distributed there is no reason not to have a local clone) where you have
committed something stupid, then it is easy to change. You can remove
the top-most changeset with 'hg rollback', and you can remove/edit
changesets further back in history using the Mercurial Queues extension:


If tip is revision 100, and you wish to edit revision 90, and there is a
linear history from 90-100, then this is what you do:

  # Change permanent changesets into editable patches
  hg qimport -r 90:100

  # Make the desired patch the top patch
  hg qpop 90.diff

  # Edit files, remove the passwords, etc...

  # Look at your changes against the original patch
  hg diff

  # Look at your changes against the previous revision
  hg qdiff

  # When satisfied, store the edits in the patch
  hg qrefresh

  # Apply all patches
  hg qpush -a

  # Change patches into changesets
  hg qdelete -r qbase:qtip

If you run 'hg tip' before and after this session you will notice that
the changeset hash has changed -- this is a natural consequence of
changing history since the hash is computed based on the contents of
each revision and on the revisions before it.

So it is simple: if you have given people access to your confidential
data, well... then its out there and you cannot stop it. If you still
have control over the data, then it is easy to remove it from your
repository, even if you have committed more stuff on top of it.

Martin Geisler

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

More information about the Mercurial mailing list