Closed branch push behavior?

Angel Ezquerra angel.ezquerra at gmail.com
Fri Dec 16 12:07:02 UTC 2011


On Tue, Dec 6, 2011 at 6:41 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Tue, 2011-12-06 at 11:38 +0100, Angel Ezquerra wrote:
>> Matt,
>>
>> I have a related question that hopefully you can also address.
>>
>> I wonder whether it makes sense for mercurial to complain that you'll
>> create a new head when you close a branch and push the resulting new head.
>>
>> Technically mercurial is right in that you are indeed pushing a new head,
>> but isn't it obvious that this new head is not meant to be developed
>> further?
>
> Sure, but that's not what push cares about here. Push cares about
> whether or not the history should be transmitted. If, for instance,
> you're Chuck's coworker, the answer here is a big fat "no": you
> shouldn't have created the branch in the first place and now this
> warning is your last chance to avoid publishing it.

Sorry for the late response to this thread. I thought that I had
already replied but I don't think I have.

>> Actually, I believe that mercurial will happily let you commit on top of a
>> "close branch commit", which would be weird (I can't test this from my
>> phone). You should have to use the --force option for that...
>
> You've already got to jump through a hoop to check out a closed head:
> you have to find it.

There may be a hoop that you have to jump though to find a closed
head, but it is a really big and easy hoop to jump through! Closed
heads are shown when you do "hg log"!

AFAIK the only effect of closing a head is that it will be hidden when
you run "hg heads". It may also hide the corresponding branch if there
are no other unclosed heads in that branch. It does not affect the
commit, push or pull commands. If you use a GUI tool such as
TortoiseHg where you always see the graph log the effect is
practically null.

I don't really get what closed heads are for:
- They don't stop you from committing on top of them
- They are calculated when counting the number of heads to push.
- They don't let you avoid having to do a dummy merge to be able to
push without using the --force flag when you want to abandon an
anonymous branch but still keep it in your history.

Angel



More information about the Mercurial mailing list