diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -707,7 +707,7 @@ commands = commanddict() # 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. diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh --- a/tests/wireprotohelpers.sh +++ b/tests/wireprotohelpers.sh @@ -16,12 +16,22 @@ from mercurial import ( ) @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