mercurialbranching-and-mergingmercurial-queue

How to untangle/undo a merge over applied MQ patches?


I accidentally merged a branch into a workspace with applied patches.

How do I clean up this mess? Do I have to clean the merge (hg up -C) or is there some way to save my merge?


Solution

  • Mercurial 1.9.1, TortoiseHg 2.1.2

    I reproduced the basis of the situation with these commands on a fresh repo:

    echo first > file.txt
    hg add
    hg ci -m first
    hg branch test
    echo test1 >> file.txt
    hg ci -m test1
    hg up 0
    echo patch >> file.txt
    hg qnew -f patch.diff
    

    Then I performed hg merge test and resolved conflicts, and tried some different things:

    The only thing I found I could do to keep the merge was to finish the patches and commit the merge changeset. With the givens, I think keeping the patches and keeping the merge are mutually exclusive.

    I know that pbranch allows merging with patches, and there's probably some way to import your MQ patches into it. I don't think it's supported in TortoiseHg, though.