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
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
).Inactive only means it has not a head.
In your case the graph is like this:
*
means the "working dirWhen you do more fixes in your feature (like nodes 2 and 3) this will be the aspect:
When you want to integrate
feature-branch
into thedefault
just update to thedefault
and then merge
feature-branch
into thedefault
:The fact that it appears "inactive" is not meaning you can't work with it. For example, your "deployment scripts" can have a
hg update --clean default
that will perfectly work even if it appeared as "inactive".Inactive just meant it had no heads. Nothing else. After merging it will become active and it will be
feature-branch
which will become "inactive".Don't mind its active/inactive state, just work with it normally.