Ensuring a merge between branches happens in one direction

后端 未结 3 1674
清酒与你
清酒与你 2021-02-08 01:59

This morning I discovered that my co-worker had merged the wrong way between two branches in mercurial --we have a ver5 and ver6 branch, with extra files in ver6. Is there any w

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-08 02:37

    This should do it. It uses a revset query to find any merges into ver5 from ver6.

    hg log -r 'children(p2(::ver5 and ::ver6 and merge()) and branch(ver6)) and branch(ver5)'
    
    • ::ver5 and ::ver6 and merge() finds all merges that are ancestors of both ver5 and ver6 branches
    • p2(...) and branch(ver6) grabs the second parent (incoming changeset) that are on the ver6 branch.
    • children(...) and branch(ver5) then grabs the actual merge changeset that is on the ver5 branch.

    I recently needed to figure this out myself, but also needed to ensure that default wasn't indirectly merged into my release branch, i.e. default -> feature -> release.

提交回复
热议问题