Michael Mior
Michael Mior

Reputation: 28752

hg unbundle into new branch

Is it possible to unbundle bundled changesets into a new branch in a repository? I have tried switching to a new branch before performing the unbundle, but that doesn't work.

Basically I have started a new development line and realized my commits should have been in a new branch. I've done hg strip to remove the changesets into a bundle and now I would like to recommit this bundle to a new branch.

I suppose I could recreate patches for each commit and then recommit each manually (or perhaps write a script to do it), but this seems unnecessary. Thanks for the help!

Upvotes: 2

Views: 2483

Answers (3)

Ry4an Brase
Ry4an Brase

Reputation: 78350

No. The branch attribute is part of the changeset itself and altering it would alter the hashid, essentially making it a different changeset. A bundle is just a push/pull done manually, and it can't alter the changesets so it can't change their branch. The only things that can are things that actually modify the changeset or recreate it like export/import, transplant, histedit, mq, and convert.

Upvotes: 1

djc
djc

Reputation: 11731

In general, unbundle will add the old changesets exactly as they were (starting off from the same parent changeset). A nice alternative to recreating patches for each commit might be in using the transplant or rebase extension (I'd go for rebase in this case).

Upvotes: 3

Ben.Vineyard
Ben.Vineyard

Reputation: 1169

You could clone your repository to a temporary repository, unbundle the bundle into it, check the changes, and if you're satisfied, push them to your main repository. If you don't approve of the changes, simply delete the temporary repository and the bundle.

Upvotes: 0

Related Questions