changeset 29865:a1092e2d70a3

help: internals topic for wire protocol The Mercurial wire protocol is under-documented. This includes a lack of source docstrings and comments as well as pages on the official wiki. This patch adds the beginnings of "internals" documentation on the wire protocol. The documentation should have nearly complete coverage on the lower-level parts of the protocol, such as the different transport mechanims, how commands and arguments are sent, capabilities, and, of course, the commands themselves. As part of writing this documentation, I discovered a number of deficiencies in the protocol and bugs in the implementation. I've started sending patches for some of the issues. I hope to send a lot more. This patch starts with the scaffolding for a new internals page.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 22 Aug 2016 19:46:39 -0700
parents 33461139c31c
children b42c26b0a785
files contrib/wix/help.wxs mercurial/help.py mercurial/help/internals/wireprotocol.txt tests/test-help.t
diffstat 4 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/wix/help.wxs	Thu Aug 18 15:13:56 2016 +0900
+++ b/contrib/wix/help.wxs	Mon Aug 22 19:46:39 2016 -0700
@@ -42,6 +42,7 @@
             <File Id="internals.changegroups.txt" Name="changegroups.txt" />
             <File Id="internals.requirements.txt" Name="requirements.txt" />
             <File Id="internals.revlogs.txt"      Name="revlogs.txt" />
+            <File Id="internals.wireprotocol.txt" Name="wireprotocol.txt" />
           </Component>
         </Directory>
 
--- a/mercurial/help.py	Thu Aug 18 15:13:56 2016 +0900
+++ b/mercurial/help.py	Mon Aug 22 19:46:39 2016 -0700
@@ -192,6 +192,8 @@
      loaddoc('requirements', subdir='internals')),
     (['revlogs'], _('Revision Logs'),
      loaddoc('revlogs', subdir='internals')),
+    (['wireprotocol'], _('Wire Protocol'),
+     loaddoc('wireprotocol', subdir='internals')),
 ])
 
 def internalshelp(ui):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/help/internals/wireprotocol.txt	Mon Aug 22 19:46:39 2016 -0700
@@ -0,0 +1,11 @@
+The Mercurial wire protocol is a request-response based protocol
+with multiple wire representations.
+
+Each request is modeled as a command name, a dictionary of arguments, and
+optional raw input. Command arguments and their types are intrinsic
+properties of commands. So is the response type of the command. This means
+clients can't always send arbitrary arguments to servers and servers can't
+return multiple response types.
+
+The protocol is synchronous and does not support multiplexing (concurrent
+commands).
--- a/tests/test-help.t	Thu Aug 18 15:13:56 2016 +0900
+++ b/tests/test-help.t	Mon Aug 22 19:46:39 2016 -0700
@@ -933,6 +933,7 @@
        changegroups  Changegroups
        requirements  Repository Requirements
        revlogs       Revision Logs
+       wireprotocol  Wire Protocol
 
 sub-topics can be accessed
 
@@ -2895,6 +2896,13 @@
   </td><td>
   Revision Logs
   </td></tr>
+  <tr><td>
+  <a href="/help/internals.wireprotocol">
+  wireprotocol
+  </a>
+  </td><td>
+  Wire Protocol
+  </td></tr>