Patchwork D3207: wireproto: make @wireprotocommand version 1 only by default

login
register
mail settings
Submitter phabricator
Date April 11, 2018, 4:35 p.m.
Message ID <6587a594a5fb369fb42bcc0f58eec355@localhost.localdomain>
Download mbox | patch
Permalink /patch/30711/
State Not Applicable
Headers show

Comments

phabricator - April 11, 2018, 4:35 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG693cb3768943: wireproto: make @wireprotocommand version 1 only by default (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3207?vs=7911&id=7986

REVISION DETAIL
  https://phab.mercurial-scm.org/D3207

AFFECTED FILES
  mercurial/wireproto.py
  tests/wireprotohelpers.sh

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh
--- a/tests/wireprotohelpers.sh
+++ b/tests/wireprotohelpers.sh
@@ -16,12 +16,22 @@ 
 )
 
 @wireproto.wireprotocommand('customreadonly', permission='pull')
-def customreadonly(repo, proto):
+def customreadonlyv1(repo, proto):
+    return wireprototypes.bytesresponse(b'customreadonly bytes response')
+
+@wireproto.wireprotocommand('customreadonly', permission='pull',
+                            transportpolicy=wireproto.POLICY_V2_ONLY)
+def customreadonlyv2(repo, proto):
     return wireprototypes.bytesresponse(b'customreadonly bytes response')
 
 @wireproto.wireprotocommand('customreadwrite', permission='push')
 def customreadwrite(repo, proto):
     return wireprototypes.bytesresponse(b'customreadwrite bytes response')
+
+@wireproto.wireprotocommand('customreadwrite', permission='push',
+                            transportpolicy=wireproto.POLICY_V2_ONLY)
+def customreadwritev2(repo, proto):
+    return wireprototypes.bytesresponse(b'customreadwrite bytes response')
 EOF
 
 cat >> $HGRCPATH << EOF
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -707,7 +707,7 @@ 
 # For version 2 transports.
 commandsv2 = commanddict()
 
-def wireprotocommand(name, args='', transportpolicy=POLICY_ALL,
+def wireprotocommand(name, args='', transportpolicy=POLICY_V1_ONLY,
                      permission='push'):
     """Decorator to declare a wire protocol command.