mercurial/wireproto.py
changeset 37488 3b99eb028859
parent 37487 68915b9f8e96
child 37489 6e6d68c2d39c
--- a/mercurial/wireproto.py	Wed Mar 28 16:00:02 2018 -0700
+++ b/mercurial/wireproto.py	Wed Mar 28 16:10:41 2018 -0700
@@ -828,7 +828,8 @@
 
     return wireprototypes.bytesresponse(''.join(r))
 
-@wireprotocommand('branchmap', permission='pull')
+@wireprotocommand('branchmap', permission='pull',
+                  transportpolicy=POLICY_V1_ONLY)
 def branchmap(repo, proto):
     branchmap = repo.branchmap()
     heads = []
@@ -1210,6 +1211,14 @@
 
 # Wire protocol version 2 commands only past this point.
 
+@wireprotocommand('branchmap', permission='pull',
+                  transportpolicy=POLICY_V2_ONLY)
+def branchmapv2(repo, proto):
+    branchmap = {encoding.fromlocal(k): v
+                 for k, v in repo.branchmap().iteritems()}
+
+    return wireprototypes.cborresponse(branchmap)
+
 @wireprotocommand('heads', args='publiconly', permission='pull',
                   transportpolicy=POLICY_V2_ONLY)
 def headsv2(repo, proto, publiconly=False):