tags:

views:

84

answers:

1

I want to remove a changeset from history but hg export does not work for merge changesets (see http://mercurial.selenic.com/wiki/Export). Is there a way to use hg pull for a range of revisions? For example, say I want to remove revision 999 I want to be able to say:

hg init NewRepo
hg pull ../OldRepo -r 0:1000
hg pull ../OldRepo -r 1000:tip

Any ideas?

A: 

Pull can't pull a range of revisions because every mercurial revision that exists in a repository must have all of its ancestor changesets in that revision too. So if you do:

hg pull ../oldRepo -r 1000

you get all of revision 1000's ancestor revisions too.

In general, mercurial is about building an immutable history -- if you regret a changeset you don't remove it you create a new one that undoes the work of the changeset you no longer like. If you can't abide having full history in your repo you need to use something like the strip or convert extension. Both work as advertised, but provide plenty of opportunities to shoot yourself in the foot. If you can stand it, just undo the onerous changeset in a subsequent changeset and move on.

Ry4an
I want to shoot myself in the foot. How can I use hg convert to strip out multiple discrete revisions? For example, given revisions 0 to 1000, I want to remove 205, 405 and 934.
Gili
I think you could use a --splicemap option with convert to make the children of those revisions children of those revisions' parents instead, which would make those revisions heads. You'd then do a local clone with -r to pull all the heads except those. I've not tried it because it's not a good idea. :)
Ry4an