From 7ef2bb1b569bd0e6c989a78b701e726fcab3600b Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 23 Aug 2018 14:59:42 -0700 Subject: [PATCH] Support Mercurial "protocaps" wire command Summary: Ref T13187. See PHI834. Mercurial has somewhat-recently (changeset is from Jan 2018) introduced a new "protocaps" command, that appears in Mercurial 4.7 and possibly before then. We must explicitly enumerate all protocol commands because you can't decode the protocol without knowing how many arguments the command expects, so enumerate it. (Also fix an issue where the related error message had an extra apostrophe.) Test Plan: - Ran `hg clone ...` with client and server on Mercurial 4.7. - Before: fatal on unknown "protocaps" command. - Midway: better typography in error message. - After: clean clone. Reviewers: amckinley Maniphest Tasks: T13187 Differential Revision: https://secure.phabricator.com/D19596 --- .../diffusion/protocol/DiffusionMercurialWireProtocol.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php index 251935a6dc..8a9deb5d84 100644 --- a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php @@ -23,12 +23,16 @@ final class DiffusionMercurialWireProtocol extends Phobject { 'listkeys' => array('namespace'), 'lookup' => array('key'), 'pushkey' => array('namespace', 'key', 'old', 'new'), + 'protocaps' => array('caps'), 'stream_out' => array(''), 'unbundle' => array('heads'), ); if (!isset($commands[$command])) { - throw new Exception(pht("Unknown Mercurial command '%s!", $command)); + throw new Exception( + pht( + 'Unknown Mercurial command "%s"!', + $command)); } return $commands[$command]; @@ -49,6 +53,7 @@ final class DiffusionMercurialWireProtocol extends Phobject { 'known' => true, 'listkeys' => true, 'lookup' => true, + 'protocaps' => true, 'stream_out' => true, );