Question about branching and merging

Matt Mackall mpm at selenic.com
Tue Aug 26 06:06:05 UTC 2014


On Tue, 2014-08-26 at 13:58 +1000, Lawrence Stewart wrote:
> Hi all,
> 
> Hoping to get some thoughts on how to manage the following.
> 
> Given a repository with branch structure and history like this:
> 
> 
> A1---A2---A3---A4---A5---A6---A7->
>       \
>        B1---B2---B3---B4---B5---B6---B7->
>              \  SYNC MERGE  \
>               C1---C2---C3---C4---C5---C6->
>                \         \    \
>                 D1--------D2---D3->
> 
> "A" and "B" branches are vendor sources tracked on a per commit basis,
> with "A" being running "trunk" development and "B" being a stable branch
> which receives bug fixes and backported functionality from "A".
> Unfortunately the Hg repo doesn't track history for commits backported
> from "A" to "B" due to hg convert not knowing about such things.
> 
> "C" and "D" are our private development and production branches
> respectively based on the vendor's stable branch "B", with "C" receiving
> periodic sync merges from "B", and "D" receiving cherry picked commits
> from "C" (including the sync merges) once they have passed internal
> review and testing.
> 
> We want to transition over to using the vendor's dev branch "A" as the
> basis for our private development work i.e. create a private branch "E"
> off "A".
> 
> During the transition period of a few months, our core development work
> will continue on branch "C", and we want to keep "E" in sync with "C"
> via sync merges while we shake out issues with "E". Eventually "E" will
> become the new equivalent of "C", and an "F" will be created off "E" to
> act as the new "D".
> 
> Is there a sane way to manage sync merging "C" into "E" such that we
> preserve the state of E's base branch "A" in preference to C's base
> branch "B"?

The short answer is no. The problem is pretty fundamental to merge (and
not terribly specific to Mercurial): merge considers every change a good
change, symmetrically, so there's no way to say "but ignore this stuff
over here..".

You might want to instead use graft or rebase --keep to move things
across.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list