[PATCH] Improved named branch support when pushing changesets

Sune Foldager cryo at cyanite.org
Thu Mar 26 16:13:06 CDT 2009


On 26/03/2009, at 20.15, Matt Mackall wrote:

> Very interesting.

Thanks :-)

> Did you consider using lookup to lookup individual heads?

Yes, we did consider using the already available information, as well  
as already available wire-commands to get the desired information  
across. The problem is that a branch head isn't necessarily a head in  
the graph, so remote.heads() won't always return it. Even if it could  
work with lookup, we would get quite a few roundtrips for complex  
repositories. Extending with a 'branchmap' command, we get all the  
information (all heads on all branches) in a single chunk :-).

>> We added a new method, branchmap, which just calls _branchheads,  
>> since
>> we need this map as a whole, and it's inefficient to call branchheads
>> once for each branch. It may be desirable to simply rename  
>> _branchheads
>> to branchmap (or some other name) and/or to deep or shallow-clone the
>> returned dictionary for safety.
>
> I suppose that's not horrible. What happens when you're talking to an
> old server?

When the remote lacks the new capability ('branchmap'), the behavior  
reverts to the one currently used, where the graph as a whole is  
considered and named branches are ignored. Also, for situations with  
only one named branch (e.g. for people who don't want to use the named  
branch feature), the behavior is of course exactly like it is now,  
with or without the new capability.

-- 
Sune Foldager.



More information about the Mercurial-devel mailing list