hg heads -a showing closed branch
Peter Mayne
PJDM at internode.on.net
Thu Jul 9 05:28:49 CDT 2009
Matt Mackall wrote:
> On Wed, 2009-07-08 at 22:52 +1000, Peter Mayne wrote:
>> Shouldn't "hg heads -a" only show the active head (default), and not the
>> head from the closed branch (br1)? If so, wouldn't -a be a good default
>> for "hg heads", as it appears to be for "hg branches"?
>
> heads -a or heads -c without a branch name should actually raise an
> error. There are two different concepts:
>
> heads: all changesets with no descendants (hg heads)
>
> branch heads: all changesets in a branch with no descendants in that
> branch (hg heads <branch>)
>
> Active and closed are only intended to apply to the latter. In fact
> heads -a is redundant: active heads are the branch heads that are also
> heads. We could make heads -a and -c 'work', but I fear that would just
> encourage the existing confusion between the two head concepts.
Conflating two concepts with one command is indeed confusing.
My confusion is increased by "hg help heads":
-a --active show only the active heads from open branches.
-c --closed show normal and closed heads
My expectation is that I close a branch because this line of development
has come to a dead end, and I don't want to be bothered with it any
more. Therefore, when a branch has been closed I shouldn't see it (in
branches, heads, log, for instance) unless I explicitly ask to see
closed branches (with -c ?). "hg branches" appears to do what I think it
should do, and I (rightly or wrongly) interpret the help for heads as
meeting that expectation, even if the results don't.
I'll ask the higher level question that I haven't seen addressed (the
book's chapter on branchy development doesn't consider closing
branches): what does closing a branch actually mean? Maybe my
expectations need adjusting. :-)
I should note that I expect a closed branch to remain in the repository;
it may be useful in the future, and the commit --close-branch message
should at least explain why the branch was closed. Pruning branches
(http://mercurial.selenic.com/wiki/PruningDeadBranches) is another thing
altogether.
Thanks.
PJDM
More information about the Mercurial
mailing list