Differences between revisions 1 and 2
Revision 1 as of 2005-08-26 00:58:10
Size: 1561
Editor: waste
Comment:
Revision 2 as of 2005-08-26 01:22:42
Size: 1595
Editor: waste
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
''heads()'' {{{heads()}}}
Line 12: Line 12:

''
branches(list)''
{{{branches(list)}}}
Line 20: Line 19:

''
between(list)''
{{{between(list)}}}
Line 27: Line 25:

''
changegroup(roots)''
{{{changegroup(roots)}}}
Line 32: Line 29:
Line 34: Line 30:
 * a changelog group
 * a manifest group
 * a list of
** filename length
** filename
** file group (terminated by a zero length filename)
   * * a changelog group
   * * a manifest group
   * * a list of
   * filename length
   * filename
   * file group (terminated by a zero length filename)
Line 42: Line 38:
 * chunk length
 * self hash, p1 hash, p2 hash, link hash
 * uncompressed delta to p1
 * (terminated by a zero length chunk)
   * * chunk length
   * * self hash, p1 hash, p2 hash, link hash
   * * uncompressed delta to p1
   * * (terminated by a zero length chunk)

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)