views:

106

answers:

1

Hi,

I did a hg update --force <repo> hg pull --update --force <other repo> to get another seemingly unrelated repository into the current one.

Afterwards I merged the first changeset of the other repo (to get renamings "right").

A rebase of the other repository starting from the second changeset left the first changeset (here: revision 5431) dangling in the repository:

o  changeset:   5433:68c67c7e0bbb
|
o    changeset:   5432:331ee440893a
|\   
| |
| o  changeset:   5431:1023b4c44f18
|
o  changeset:   5430:15aff858ec36

To clean things up I'd like to get rid of revision 5431. How would I do that?

Thanks.

+1  A: 

By doing hg strip 5431, strip is in the mq extension.

Note that strip is a destructive operation, use with care!

mizipzor
It's irresponsible to recommend 'strip' without providing the basic warnings. Strip and other history-editing commands aren't part of the default mercurial feature set for a reason -- mercurial is about an immutable sequence of changesets, and extensions that rewrite history have inherent risks and range from useless to dangerous if folks have already pulled the changesets.
Ry4an
Since strip is a command you have to explicitly enable I just linked to the wiki pages that have the instructions for doing so. Those pages also gives all the necessary warnings. I thought that was enough (would have been a different thing if I included the instructions for enabling it here), but sure I put in a small warning here as well.
mizipzor
Thanks for your answer and the warnings - I've used ´strip´ in some places but have been boggled by the first paragraph of its help: ´strip a changeset and all its descendants from the repository´.Well - it did just that, i.e. not only changeset 5431 was stripped, but also all descendants - lucky me there is ´hg unbundle´ :-)I want to get rid of changeset 5431 and *only* that changeset.
steglig
I thought 5431 had no descendants. Would that mean that 5433 is the tip and 5431 and 5430 has no common ancestor? What do you mean with "rebase", by the way? Are you referring to the mercurial extension?
mizipzor
He has two roots (5430 and 5431) and stripping away 5431 will also remove 5432 and 5433 since they are children of 5431. There is basically no way to remove an ancestor without removing the children as well.
Martin Geisler
@mizipzor: I did a ´hg pull --update --force <other repo>´ (corrected that in my question) and then rebased the second commit of the pulled repo on top of the current repo.
steglig
@Martin: Thanks - then I'll have to live with that unsightliness.
steglig