Differences between revisions 5 and 6
Revision 5 as of 2005-08-26 01:33:38
Size: 1575
Editor: waste
Comment:
Revision 6 as of 2005-08-26 01:36:47
Size: 1567
Editor: waste
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
Line 19: Line 18:
Line 26: Line 24:
Line 31: Line 28:

The Mercurial wire protocol

Mercurial performs all of its network transactions over HTTP.

The network protocol looks like this:

heads()

 return a list of heads
 (everything new must be an ancestor of one of these heads, so start here)

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)

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)

changegroup(roots)

 find all changesets descended from roots and return them as a single changegroup

A changegroup is a single stream containing:

  • a changelog group
  • a manifest group
  • a list of
    • filename length
    • filename
    • file group (terminated by a zero length filename)

A group is a list of chunks:

  • chunk length
  • self hash, p1 hash, p2 hash, link hash
  • uncompressed delta to p1
  • (terminated by a zero length chunk)

Hgweb/remoterepository currently runs this all through zlib which makes sense on WANs, but less sense on LANs.

The first three functions are used to efficiently track back through a remote tree to find the roots of all the new branches, without a massive number of round trips or needing to send the entire changelog list.

The fourth actually gets all the changes in one go.

WireProtocol (last edited 2011-05-01 12:19:06 by PeterArrenbrecht)