Wiki: WireProtocol

Matt Mackall mpm at selenic.com
Tue Sep 6 13:06:55 CDT 2005


On Fri, Sep 02, 2005 at 08:01:51PM -0700, Eric Hopper wrote:
> I'm looking at this document and finding it slightly confusing.  I wish
> it were editable because then I'd just put in my guesses about what
> certain things mean and watch to see if I was right.  :-)

It ought to be editable. Are you logged in?

> branches(list)
> 
>  for node in list:
>    follow the linear section of a branch back to its branchpoint
>    return (tip, base, p1, p2)
>    (this reduces round trips for long linear branches)
> 
> Do p1 and p2 refer to the parents of base? 

Yes.

> What happens if the search
> goes all the way to the root node?

You get the nullid (000..).

> You might also state that a
> branchpoint might be called a mergepoint if you were looking at things
> from the other direction.  :-)

Sure.

> between(list)
> 
>  for tip, base in list:
>    walk back a linear branch, return elements 1, 2, 4, 8..
>    (and this lets us do bisection search if we diverge in the middle of
>    one of these long branches)
> 
> What happens here if the client hands you a tip and base that do not
> have a linear relationship?

Then the server hands back undefined garbage.

> Do you walk from the base to the tip when
> returning elements?

No, we walk from tip to base. Between is defined to operate on a
section of history with no merges, so each element has exactly one
parent. So we simply walk tip->p1->p1->...->base. Then we return
elements 1, 2, 4, 8,.. of the resulting list.

> If you don't, how is a search accomplished?  Since
> presumably it's the tip that won't be known, you'll always return the
> same pattern of elements no matter what the client specifies as the
> base.

Huh?

> Does the protocol allow for streaming HTTP requests?

What request batching can be done is done internally. There's not a
lot of opportunity for parallelism here.
 
> Also, the description of a changegroup isn't quite clear enough.  What's
> a link hash?  What happens if a node doesn't have a second parent?  are
> all the different kinds of group the same format?  If so, why are there
> different kinds of group?

A link hash is the hash of the associated changeset. Nodes always have
a second parent, though usually it's the nullid. All the groups are in
the same format, over the wire and on disk. The only differences are
what Mercurial uses them for - a changelog is different from a filelog.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list