Does anyone use named branches?

Adrian Buehlmann adrian at cadifra.com
Fri Oct 16 13:34:09 UTC 2009


On 15.10.2009 12:32, Christian Boos wrote:
> Adrian Buehlmann wrote:
>> On 15.10.2009 01:18, Bryan O'Sullivan wrote:
>>   
>>> I keep wanting to like named branches, but I get consistently pushed
>>> away from them.
>>>
>>> In a world without branch naming, anonymous branches are implicitly
>>> named "default".
>>>
>>> Approximately 100% of the time, except during occasional brief merges, I
>>> want to have just one named branch active in any given repository. So if
>>> I check out my "1.2" branch, I want it to contain the named branch
>>> "1.2", and I'd really like Mercurial to update to the tip of that branch
>>> when I clone it. But instead, it updates to the tip of the "default"
>>> branch, and I then have to manually update to the tip of "1.2" by hand
>>> afterwards.
>>>     
>> In the case of doing a local clone, it could indeed read the branch currently
>> set in the source repo's working dir and update the new clone to that branch
>> instead of to 'default'.
>>
>> IMHO, this behavior change would make a lot of sense and it wouldn't hurt
>> those users who don't use named branches anyway (since their named branch
>> in the source repo is always 'default' anyway).
>>   
> 
> I'd second that, this is also my experience.
> 
>> In case there are concerns about changing the default behavior, this new
>> behavior could be introduced by using a config option, let's say 'clonebranch'
>> in section [ui], with a default of False. Setting it to True would checkout
>> the branch set in the source repo's working dir when doing a local clone.
>>
>>   
> 
> When doing a clone, isn't the .hgrc [paths] default = ... set to the 
> source of the clone?

Yes.

> Likewise, we could imagine a [paths] default-update = ... entry which 
> could be set to the branch name of the tip of the clone source, or more 
> precisely, to the branch name of the revision used for cloning the 
> source repository, useful in case of `hg clone -r <branch>`.
> 

Using the branch name of the tip revision of the source repo seems
useless to me when cloning, since 'hg tip' may be from random named branches
(from whatever named branch the last added changeset may happen to
belong to -- quite random, that is).

It might be interesting to note that Mercurial currently already
writes

   [paths]
   default = <url>#<branch>

to the '.hg/hgrc' file of the new clone if the clone was done using

   hg clone <url>#<branch> <dest>

Subsequent 'hg pull's seem then to be limited to pulling changesets from
that branch only.




More information about the Mercurial mailing list