Search code examples
plasticscm

Can't push to Plastic SCM server: the source branch can't have multiple heads


I'm trying to push a changesets on a branch on a local repository to one on the Plastic SCM cloud. As far as I can tell in the Branch Explorer, there is only one head on the branch. But when I try to push, I get the error "The source branch can't have multiple heads." How can I solve this error? Where can I find this second head that Plastic is talking about?


Solution

  • Sometimes is hard to find the changesets that are not merged and causing the double head scenario.

    I've created this small tool -> MultipleHeaderFinder that is able to ignore already merged changesets, this is how you can use it (assuming you are replicating the main branch of the quake@localhost:8087 repository):

    1. cm find merge where srcbranch='br:/main' and dstbranch='br:/main' --format={srcchangeset} --nototal > merges.txt
    2. cm find changesets where branch='/main' --format={changesetid}@{parent} --nototal > csets.txt
    3. MultipleHeaderFinder.exe csets.txt merges.txt quake@localhost:8087

    It will return something like:

    mount:56e62dd7-241f-41e9-8c6b-dd4ca4513e62#quake@localhost:8087 merged from: Merge 476

    The last number is the changeset causing the issue, you can find it in the branch explorer and merge it. You might have more than one, in that case repeat the merge for each changeset found.

    Hope it helps!