Reputation: 1128
I have a branch dev
that has been merged into a release
branch to form a release commit.
I am hoping to reopen dev
from after that merge commit so that my repository has a visual "fan-in fan-out" style. By that I mean that all commits and branches converge into my release commit and then work for the next release diverges out of it. This visually makes it very easy to see what is contained in each release as it keeps them isolated between our tagged release commits.
The effect is that dev
is no longer a contiguous branch and I am wondering if this is possible in mercurial.
When I try to hg branch dev
again after the release, mercurial complains that it already exists. Even if I commit with say --close-branch
after I merge it.
So currently my workaround is to:
(1) either use a different dev-VERSION
for each release which is more fiddly and harder to script or
(2) run dev
in parallel to release
and keep merging from dev
into release
which isn't so bad, just a little messier for our particular release process.
I know that this might seem like a non-standard mercurial release process. It would suit our particular project and team structure really well though.
Thanks for any help!
EDIT:
To make what I mean a bit clearer, imagine I had merged a feature-01
branch into dev
and then merged dev
into release
in order to create release-1.1
. Then I want to make a new feature-02
branch off that merges into dev
with a visualisation like:
@ changeset: 6:4bcc59fe6ded
|\ branch: dev
| | summary: Merge feature-02
| |
| o changeset: 5:8e117ffe64d0
| | branch: feature-02
| | summary: Add d
\ |
o changeset: 4:c39dae3ff2fa <---- all commits converge to here then diverge back out
/| branch: release
| | summary: Release v1.1
| |
o | changeset: 3:c89af2b3e8db
| | branch: dev
summary: Merge feature-01
This is an example bash script where I'm trying to get something like this:
# Create test
rm -rf test
mkdir test
cd test
# Set up v1.0
hg init
hg branch release
touch a
hg commit -m 'Release v1.0'
# Set up dev branch
hg branch dev
touch b
hg add b
hg commit -m 'Created dev'
# Feature branch
hg branch feature-01
touch c
hg add c
hg commit -m 'Add c'
hg update dev
hg merge feature-01
hg commit -m 'Merge feature-01'
# Release all the things
hg update release
hg merge dev
hg commit -m 'Release v1.1'
# Start a new feature branch
hg update dev # <------ crucial line
hg branch feature-02
touch d
hg add d
hg commit -m 'Add d'
hg update dev
hg merge feature-02
hg commit -m 'Merge feature-02'
If I try to continue feature-02
on the dev
branch, it ends up having commit 3:e7ba9d1d9bfe
as it's parent when I would like it to have the release commit 4:bbc951a4b339
as its parent but still be on the dev
branch.
hg log -G
gives roughly this output:
@ changeset: 6:46539f99dadd
|\ branch: dev
| | tag: tip
| | summary: Merge feature-02
| |
| o changeset: 5:885b0b930fed
|/ branch: feature-02
| summary: Add d
|
| o changeset: 4:bbc951a4b339 <--- not the parent of the new changes
|/| branch: release
| | summary: Release v1.1
| |
...
I could change my process so that the first feature branch after a new release is branched directly off release
, but that makes the process harder to script and just delays the problem until I have to merge it into dev
:
So if I use the same script as above but change it slightly:
...
# Start a new feature branch
#hg update dev
hg update release # <--- changed to release
hg branch feature-02
...
Then my graph ends up being:
@ changeset: 6:4bcc59fe6ded <---- has the previous `dev` as a parent
|\ branch: dev
| | summary: Merge feature-02
| |
| o changeset: 5:8e117ffe64d0
| | branch: feature-02
| | summary: Add d
| |
| o changeset: 4:c39dae3ff2fa
|/| branch: release
| | summary: Release v1.1
| |
o | changeset: 3:c89af2b3e8db
|\ \ branch: dev
|| | summary: Merge feature-01
...
If I try to rebranch dev
:
...
# Start a new feature branch
#hg update dev
#hg update release
hg branch dev # <--- changed
hg branch feature-02
...
I get an error: abort: a branch of the same name already exists
.
I hope that helps make it clearer! Thanks for any help!
Upvotes: 0
Views: 121
Reputation: 5590
After doing your merge, just do hg update dev
and start making commits. You don't need to close and reopen the branch. You don't need to create a new branch.
Upvotes: 1