A: 

It looks like there is a way in Vanilla mercurial, you diff you repo, then revert, then apply the patch...

hg diff > somefile # save local changes

hg revert -a       # nuke 'em

hg import --no-commit somefile

complete reference in hg faq.

phmr
revert doesn't touch the history, so the push will stay as big as before.
tonfa
A: 

Mercurial history is immutable, you can't delete using the normal tools. You can, however, create a new repo without those files:

$ hg clone -r 1 repo-with-too-much new-repo

that takes only revisions zero and one from the old repo and puts them into a new repo. Now copy the files from revision four into the new repo and commit.

This gets rid of those interstitial changesets, but any repo you have out there in the wild still has them, so when you pull you'll get them back.

In general once you've pushed a changeset it's out there and unless you can get everyone with a clone to delete it and reclone you're out of luck.

Ry4an
+1  A: 

It's not clear from your question weather those changes got pushed. If they're still local, you can more or less get rid of them easily. convert is one option. You can also use MQ (mercurial queues). Check the EditingHistory wiki article for a detailed explanation. It recommends MQ being the simplest approach.

To prevent that kind of mistakes, you'd maybe add a hook to reject 'bad' commits, given that you can describe them programmatically ;)

milan
I use mercurial to store the db of my application, so I just .hgignored every bits of the db and commited only a jar.
phmr
A: 

Install some application on ur PC,like Privacy protector Of "Advanced System Optimizer",it does the permanent deletion of ur confidential information like history.u can download this from cnet

jeymathew