Differences between revisions 3 and 4
Revision 3 as of 2005-08-26 01:23:56
Size: 1567
Editor: waste
Comment:
Revision 4 as of 2005-08-26 01:31:41
Size: 1581
Editor: waste
Comment:
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
 (everything new must be an ancestor of one of these heads, so start here)   (everything new must be an ancestor of one of these heads, so start here)
Line 15: Line 16:
   follow the linear section of a branch back to its branchpoint
   return (tip, base, p1, p2)
   (this reduces round trips for long linear branches)
  follow the linear section of a branch back to its branchpoint
    return (tip, base, p1, p2)
  (this reduces round trips for long linear branches)
Line 22: Line 24:
   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)
  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)
Line 28: Line 31:

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)