##// END OF EJS Templates
wireproto: don't pass transportpolicy argument...
Gregory Szorc -
r37797:379d54ea default
parent child Browse files
Show More
@@ -346,8 +346,7 b' def wireprotocommand(name, args=None, tr'
346 return register
346 return register
347
347
348 # TODO define a more appropriate permissions type to use for this.
348 # TODO define a more appropriate permissions type to use for this.
349 @wireprotocommand('batch', 'cmds *', permission='pull',
349 @wireprotocommand('batch', 'cmds *', permission='pull')
350 transportpolicy=POLICY_V1_ONLY)
351 def batch(repo, proto, cmds, others):
350 def batch(repo, proto, cmds, others):
352 unescapearg = wireprototypes.unescapebatcharg
351 unescapearg = wireprototypes.unescapebatcharg
353 repo = repo.filtered("served")
352 repo = repo.filtered("served")
@@ -393,8 +392,7 b' def batch(repo, proto, cmds, others):'
393
392
394 return wireprototypes.bytesresponse(';'.join(res))
393 return wireprototypes.bytesresponse(';'.join(res))
395
394
396 @wireprotocommand('between', 'pairs', transportpolicy=POLICY_V1_ONLY,
395 @wireprotocommand('between', 'pairs', permission='pull')
397 permission='pull')
398 def between(repo, proto, pairs):
396 def between(repo, proto, pairs):
399 pairs = [wireprototypes.decodelist(p, '-') for p in pairs.split(" ")]
397 pairs = [wireprototypes.decodelist(p, '-') for p in pairs.split(" ")]
400 r = []
398 r = []
@@ -403,8 +401,7 b' def between(repo, proto, pairs):'
403
401
404 return wireprototypes.bytesresponse(''.join(r))
402 return wireprototypes.bytesresponse(''.join(r))
405
403
406 @wireprotocommand('branchmap', permission='pull',
404 @wireprotocommand('branchmap', permission='pull')
407 transportpolicy=POLICY_V1_ONLY)
408 def branchmap(repo, proto):
405 def branchmap(repo, proto):
409 branchmap = repo.branchmap()
406 branchmap = repo.branchmap()
410 heads = []
407 heads = []
@@ -415,8 +412,7 b' def branchmap(repo, proto):'
415
412
416 return wireprototypes.bytesresponse('\n'.join(heads))
413 return wireprototypes.bytesresponse('\n'.join(heads))
417
414
418 @wireprotocommand('branches', 'nodes', transportpolicy=POLICY_V1_ONLY,
415 @wireprotocommand('branches', 'nodes', permission='pull')
419 permission='pull')
420 def branches(repo, proto, nodes):
416 def branches(repo, proto, nodes):
421 nodes = wireprototypes.decodelist(nodes)
417 nodes = wireprototypes.decodelist(nodes)
422 r = []
418 r = []
@@ -425,8 +421,7 b' def branches(repo, proto, nodes):'
425
421
426 return wireprototypes.bytesresponse(''.join(r))
422 return wireprototypes.bytesresponse(''.join(r))
427
423
428 @wireprotocommand('clonebundles', '', permission='pull',
424 @wireprotocommand('clonebundles', '', permission='pull')
429 transportpolicy=POLICY_V1_ONLY)
430 def clonebundles(repo, proto):
425 def clonebundles(repo, proto):
431 """Server command for returning info for available bundles to seed clones.
426 """Server command for returning info for available bundles to seed clones.
432
427
@@ -479,14 +474,12 b' def _capabilities(repo, proto):'
479
474
480 # If you are writing an extension and consider wrapping this function. Wrap
475 # If you are writing an extension and consider wrapping this function. Wrap
481 # `_capabilities` instead.
476 # `_capabilities` instead.
482 @wireprotocommand('capabilities', permission='pull',
477 @wireprotocommand('capabilities', permission='pull')
483 transportpolicy=POLICY_V1_ONLY)
484 def capabilities(repo, proto):
478 def capabilities(repo, proto):
485 caps = _capabilities(repo, proto)
479 caps = _capabilities(repo, proto)
486 return wireprototypes.bytesresponse(' '.join(sorted(caps)))
480 return wireprototypes.bytesresponse(' '.join(sorted(caps)))
487
481
488 @wireprotocommand('changegroup', 'roots', transportpolicy=POLICY_V1_ONLY,
482 @wireprotocommand('changegroup', 'roots', permission='pull')
489 permission='pull')
490 def changegroup(repo, proto, roots):
483 def changegroup(repo, proto, roots):
491 nodes = wireprototypes.decodelist(roots)
484 nodes = wireprototypes.decodelist(roots)
492 outgoing = discovery.outgoing(repo, missingroots=nodes,
485 outgoing = discovery.outgoing(repo, missingroots=nodes,
@@ -496,7 +489,6 b' def changegroup(repo, proto, roots):'
496 return wireprototypes.streamres(gen=gen)
489 return wireprototypes.streamres(gen=gen)
497
490
498 @wireprotocommand('changegroupsubset', 'bases heads',
491 @wireprotocommand('changegroupsubset', 'bases heads',
499 transportpolicy=POLICY_V1_ONLY,
500 permission='pull')
492 permission='pull')
501 def changegroupsubset(repo, proto, bases, heads):
493 def changegroupsubset(repo, proto, bases, heads):
502 bases = wireprototypes.decodelist(bases)
494 bases = wireprototypes.decodelist(bases)
@@ -508,7 +500,7 b' def changegroupsubset(repo, proto, bases'
508 return wireprototypes.streamres(gen=gen)
500 return wireprototypes.streamres(gen=gen)
509
501
510 @wireprotocommand('debugwireargs', 'one two *',
502 @wireprotocommand('debugwireargs', 'one two *',
511 permission='pull', transportpolicy=POLICY_V1_ONLY)
503 permission='pull')
512 def debugwireargs(repo, proto, one, two, others):
504 def debugwireargs(repo, proto, one, two, others):
513 # only accept optional args from the known set
505 # only accept optional args from the known set
514 opts = options('debugwireargs', ['three', 'four'], others)
506 opts = options('debugwireargs', ['three', 'four'], others)
@@ -579,8 +571,7 b' def find_pullbundle(repo, proto, opts, c'
579 continue
571 continue
580 return None
572 return None
581
573
582 @wireprotocommand('getbundle', '*', permission='pull',
574 @wireprotocommand('getbundle', '*', permission='pull')
583 transportpolicy=POLICY_V1_ONLY)
584 def getbundle(repo, proto, others):
575 def getbundle(repo, proto, others):
585 opts = options('getbundle', wireprototypes.GETBUNDLE_ARGUMENTS.keys(),
576 opts = options('getbundle', wireprototypes.GETBUNDLE_ARGUMENTS.keys(),
586 others)
577 others)
@@ -656,12 +647,12 b' def getbundle(repo, proto, others):'
656 return wireprototypes.streamres(
647 return wireprototypes.streamres(
657 gen=chunks, prefer_uncompressed=not prefercompressed)
648 gen=chunks, prefer_uncompressed=not prefercompressed)
658
649
659 @wireprotocommand('heads', permission='pull', transportpolicy=POLICY_V1_ONLY)
650 @wireprotocommand('heads', permission='pull')
660 def heads(repo, proto):
651 def heads(repo, proto):
661 h = repo.heads()
652 h = repo.heads()
662 return wireprototypes.bytesresponse(wireprototypes.encodelist(h) + '\n')
653 return wireprototypes.bytesresponse(wireprototypes.encodelist(h) + '\n')
663
654
664 @wireprotocommand('hello', permission='pull', transportpolicy=POLICY_V1_ONLY)
655 @wireprotocommand('hello', permission='pull')
665 def hello(repo, proto):
656 def hello(repo, proto):
666 """Called as part of SSH handshake to obtain server info.
657 """Called as part of SSH handshake to obtain server info.
667
658
@@ -676,14 +667,12 b' def hello(repo, proto):'
676 caps = capabilities(repo, proto).data
667 caps = capabilities(repo, proto).data
677 return wireprototypes.bytesresponse('capabilities: %s\n' % caps)
668 return wireprototypes.bytesresponse('capabilities: %s\n' % caps)
678
669
679 @wireprotocommand('listkeys', 'namespace', permission='pull',
670 @wireprotocommand('listkeys', 'namespace', permission='pull')
680 transportpolicy=POLICY_V1_ONLY)
681 def listkeys(repo, proto, namespace):
671 def listkeys(repo, proto, namespace):
682 d = sorted(repo.listkeys(encoding.tolocal(namespace)).items())
672 d = sorted(repo.listkeys(encoding.tolocal(namespace)).items())
683 return wireprototypes.bytesresponse(pushkeymod.encodekeys(d))
673 return wireprototypes.bytesresponse(pushkeymod.encodekeys(d))
684
674
685 @wireprotocommand('lookup', 'key', permission='pull',
675 @wireprotocommand('lookup', 'key', permission='pull')
686 transportpolicy=POLICY_V1_ONLY)
687 def lookup(repo, proto, key):
676 def lookup(repo, proto, key):
688 try:
677 try:
689 k = encoding.tolocal(key)
678 k = encoding.tolocal(key)
@@ -695,22 +684,19 b' def lookup(repo, proto, key):'
695 success = 0
684 success = 0
696 return wireprototypes.bytesresponse('%d %s\n' % (success, r))
685 return wireprototypes.bytesresponse('%d %s\n' % (success, r))
697
686
698 @wireprotocommand('known', 'nodes *', permission='pull',
687 @wireprotocommand('known', 'nodes *', permission='pull')
699 transportpolicy=POLICY_V1_ONLY)
700 def known(repo, proto, nodes, others):
688 def known(repo, proto, nodes, others):
701 v = ''.join(b and '1' or '0'
689 v = ''.join(b and '1' or '0'
702 for b in repo.known(wireprototypes.decodelist(nodes)))
690 for b in repo.known(wireprototypes.decodelist(nodes)))
703 return wireprototypes.bytesresponse(v)
691 return wireprototypes.bytesresponse(v)
704
692
705 @wireprotocommand('protocaps', 'caps', permission='pull',
693 @wireprotocommand('protocaps', 'caps', permission='pull')
706 transportpolicy=POLICY_V1_ONLY)
707 def protocaps(repo, proto, caps):
694 def protocaps(repo, proto, caps):
708 if proto.name == wireprototypes.SSHV1:
695 if proto.name == wireprototypes.SSHV1:
709 proto._protocaps = set(caps.split(' '))
696 proto._protocaps = set(caps.split(' '))
710 return wireprototypes.bytesresponse('OK')
697 return wireprototypes.bytesresponse('OK')
711
698
712 @wireprotocommand('pushkey', 'namespace key old new', permission='push',
699 @wireprotocommand('pushkey', 'namespace key old new', permission='push')
713 transportpolicy=POLICY_V1_ONLY)
714 def pushkey(repo, proto, namespace, key, old, new):
700 def pushkey(repo, proto, namespace, key, old, new):
715 # compatibility with pre-1.8 clients which were accidentally
701 # compatibility with pre-1.8 clients which were accidentally
716 # sending raw binary nodes rather than utf-8-encoded hex
702 # sending raw binary nodes rather than utf-8-encoded hex
@@ -731,8 +717,7 b' def pushkey(repo, proto, namespace, key,'
731 output = output.getvalue() if output else ''
717 output = output.getvalue() if output else ''
732 return wireprototypes.bytesresponse('%d\n%s' % (int(r), output))
718 return wireprototypes.bytesresponse('%d\n%s' % (int(r), output))
733
719
734 @wireprotocommand('stream_out', permission='pull',
720 @wireprotocommand('stream_out', permission='pull')
735 transportpolicy=POLICY_V1_ONLY)
736 def stream(repo, proto):
721 def stream(repo, proto):
737 '''If the server supports streaming clone, it advertises the "stream"
722 '''If the server supports streaming clone, it advertises the "stream"
738 capability with a value representing the version and flags of the repo
723 capability with a value representing the version and flags of the repo
@@ -741,8 +726,7 b' def stream(repo, proto):'
741 return wireprototypes.streamreslegacy(
726 return wireprototypes.streamreslegacy(
742 streamclone.generatev1wireproto(repo))
727 streamclone.generatev1wireproto(repo))
743
728
744 @wireprotocommand('unbundle', 'heads', permission='push',
729 @wireprotocommand('unbundle', 'heads', permission='push')
745 transportpolicy=POLICY_V1_ONLY)
746 def unbundle(repo, proto, heads):
730 def unbundle(repo, proto, heads):
747 their_heads = wireprototypes.decodelist(heads)
731 their_heads = wireprototypes.decodelist(heads)
748
732
General Comments 0
You need to be logged in to leave comments. Login now