I am using mercurial with named branches, and notice that when I create a new branch of default, default is marked as an inactive branch. Eg:
C:\data\solutions\test-repo>hg branches
default 0:aeec280e6310
C:\data\solutions\test-repo>hg branch feature-branch
marked working directory as branch feature-branch
C:\data\solutions\test-repo>hg com -m "created new branch"
C:\data\solutions\test-repo>hg branches
feature-branch 1:1cb18d7fa554
default 0:aeec280e6310 (inactive)
This is a problem because our deployment system shows named branches that are active, which can be deployed from.
How can I keep my default branch "active" ?
The notion of "active" and "inactive" branches is something we're moving away from in the Mercurial project. The problem is simply that branches can flip back and forth between the two states more or less randomly and at inconvenient times — as you've just seen.
Instead, we're now focussing on "open" vs "closed". This is an explicit notion: to close a branch head, you do
$ hg update feature-branch
$ hg commit --close-branch -m "passes all tests, ready for merging"
That will add a special changeset that marks the branch head as closed. When all heads on a branch are closed, the branch itself it considered closed and will disappear from hg branches
. I recommend closing before merging, please see my named branch guide for a longer example.
So I suggest you change your deployment system to show open branches (hg branches
) instead of active branches (hg branches --active
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With