Reputation: 3937
Ok, complicated mercurial scenario here, but every scenario in mercurial seems to get complicated.
We have 2 branches, dev and test. Lot of changes were made in dev and then merged into test like so:
hg update test
hg merge dev
hg commit -m "merging dev into test yo"
hg push
But then we realized that we didn't want ALL of those changes from dev. So I ran a backout like so:
hg backout --rev=<test rev of my commit> --parent=<test rev from before the merge>
This successfully backed out all the changes from the merge.
Problem is: I now want to graft in SOME of the changes from the dev branch, but it ignores them all, saying 'skipping ancestor revision X'
Is there a way to get those changes reapplied? (other than exporting and reimporting a diff?)
Upvotes: 2
Views: 346
Reputation: 13008
Use the -f
option to force hg graft
to proceed anyway:
hg graft -f -r 12345
(Which was an answer to this question)
Upvotes: 0
Reputation: 13008
The OP did specifically state they wanted to avoid using diffs, but this method does work quite well in some cases and others might find it useful. Also they didn't state WHY they wanted to avoid import/export (diffs).
Taken from this blog.
You can reapply your change with this command.
Let’s assume your change is in revision 78.
Go to the root of your repo and run:
hg export 78 | hg import
This will automatically re-commit whatever changed in revision 78. You can also specify options to NOT automatically commit, and/or you can export to a file and then import in a separate step.
Upvotes: 0
Reputation: 3577
I don't know the actual state of your test
branch, but if you are still close to the backout, I suggest instead to branch out of test
before the initial merge. With this option, you won't inherit the parents from the other branch.
@ new head
|
|
o | backout
| |
| |
o | bad merge
/| |
| | |
o | | other branch
| | |
| |/
| o before merge
| |
| |
After that, graft what you need from dev
and remerge the two heads by discarding the backout completely to maintain a single head.
Upvotes: 2