merged two branches, and pushed, how to backout/strip?

Arne Babenhauserheide arne_bab at web.de
Tue Jan 10 18:29:34 UTC 2017


Uwe Brauer writes:

>    > Uwe Brauer <oub at mat.ucm.es> writes:
>
>
>    > The merge and revert are necessary, because if you only revert the
>    > default branch, this branch then contains a commit which undoes all the
>    > work in vs-11.89. If you were to do some changes and then merge it into
>    > the vs-11.89 branch to get that branch up to date, it would undo all the
>    > work done in the vs-11.89 branch up until you first merged it into
>    > default.
>
>    > Reason: Default contains a change which undoes the changes in vs-11.89.
>
>    > To fix that, vs-11.89 needs a change which undoes the undoing of its
>    > changes.
>
> This drives me crazy I understand your argument, but why isn't it
> sufficient to revert the merge in both branches. Like this
>
> Bad merge repo (now with 2 files)
>
>
> hg init
> echo Main1 > main.txt
> hg add main.txt
> hg commit -m "Main1"
> echo Main2 >> main.txt
> hg commit -m "Main1"
> hg branch vs-11.89
> echo branch1 > branch.txt
> hg add branch.txt
> hg commit -m "Good Commit1"
> echo branch2 >> branch.txt
> hg commit -m "Good Commit2"
> echo badvariable >> branch.txt
> hg commit -m "Bad Commit"
> hg up default
> hg merge vs-11.89
> hg commit -m "Bad merge"
>
>
> Your recipe
>
> # revert to last good commit in default
> hg revert --all -r 1
> hg commit -m "backout bad merge"
> # go to branch
> hg up vs-11.89
> hg merge default
> hg ci -m "merge default with the backout"
> hg log -G
> # revert the last bad commit to branch vs-11.89
> hg revert --all -r 4
> hg ci -m "backout the backout"
>
> But mine
>
> hg revert --all -r 1
> hg commit -m "backout bad merge from default"
> hg revert --all -r 4
> hg ci -m "backout bad merge from vs-11.89"
>
>
> Seems to result in the same files, but not the same graph.
>
> What do I miss?

What’s your current branch?

What happens if you merge this into the other branch?

Best wishes,
Arne



More information about the Mercurial mailing list