Multiple trunks in a single repo
We have a codebase that is scheduled to undergo major refactoring, but we need to still have sustaining engineering (bugfix releases) and interim feature releases from the legacy code base. Since the refactored new code may or may not have any direct relation to the legacy code, even though it is ultimately derived from it, it makes no sense to have a single trunk. And in particular, the fact that releases are tagged off the trunk, not the develop branch, means that we are going to be including the wrong code if we we have interleved releases from each code base.
What I've come up with is this (after already initializing the repo for hgflow use):
hg up develop hg branch legacy
<edit .hgflow and change "master = default" to "master = legacy" and "develop = develop" to "develop = develop-legacy">
hg ci -m 'Create legacy master branch' hg branch develop-legacy hg ci -m 'Create legacy develop branch' hg up develop hg merge legacy
<undo the changes to .hgflow but leave it marked as merged>
hg ci -m 'Null merge to preserve .hgflow later' hg up default hg merge develop hg ci -m 'Null merge to preserve .hgflow later'
Now, I can switch between the two trunks using
hg up develop
hg up develop-legacy
And I can use any
hg flow commands in each flow without doing anything special. Releases from develop-legacy ultimately get merged down to legacy and tags are created from there. Releases from develop ultimately get merged down to default and those tags are created from there. I can manually merge from legacy to develop after a legacy release to get the changes that are appropriate for the new codebase.