##// END OF EJS Templates
bundle2: introduce a `getrepocaps` to retrieve the bundle2 caps of a repo...
Pierre-Yves David -
r22342:262c5cc1 default
parent child Browse files
Show More
@@ -781,6 +781,14 b" capabilities = {'HG2X': (),"
781 'b2x:changegroup': (),
781 'b2x:changegroup': (),
782 }
782 }
783
783
784 def getrepocaps(repo):
785 """return the bundle2 capabilities for a given repo
786
787 Exists to allow extensions (like evolution) to mutate the
788 capabilities.
789 """
790 return capabilities
791
784 def bundle2caps(remote):
792 def bundle2caps(remote):
785 """return the bundlecapabilities of a peer as dict"""
793 """return the bundlecapabilities of a peer as dict"""
786 raw = remote.capable('bundle2-exp')
794 raw = remote.capable('bundle2-exp')
@@ -465,7 +465,7 b' def _pushbundle2(pushop):'
465 evolve in the future."""
465 evolve in the future."""
466 bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
466 bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
467 # create reply capability
467 # create reply capability
468 capsblob = bundle2.encodecaps(bundle2.capabilities)
468 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo))
469 bundler.newpart('b2x:replycaps', data=capsblob)
469 bundler.newpart('b2x:replycaps', data=capsblob)
470 replyhandlers = []
470 replyhandlers = []
471 for partgenname in b2partsgenorder:
471 for partgenname in b2partsgenorder:
@@ -588,7 +588,7 b' def _pushsyncphase(pushop):'
588 #
588 #
589 # This will eventually be unified with the changesets bundle2 push
589 # This will eventually be unified with the changesets bundle2 push
590 bundler = bundle2.bundle20(pushop.ui, b2caps)
590 bundler = bundle2.bundle20(pushop.ui, b2caps)
591 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
591 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo))
592 bundler.newpart('b2x:replycaps', data=capsblob)
592 bundler.newpart('b2x:replycaps', data=capsblob)
593 part2node = []
593 part2node = []
594 enc = pushkey.encode
594 enc = pushkey.encode
@@ -922,7 +922,7 b' def _pullobsolete(pullop):'
922 def caps20to10(repo):
922 def caps20to10(repo):
923 """return a set with appropriate options to use bundle20 during getbundle"""
923 """return a set with appropriate options to use bundle20 during getbundle"""
924 caps = set(['HG2X'])
924 caps = set(['HG2X'])
925 capsblob = bundle2.encodecaps(bundle2.capabilities)
925 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
926 caps.add('bundle2=' + urllib.quote(capsblob))
926 caps.add('bundle2=' + urllib.quote(capsblob))
927 return caps
927 return caps
928
928
@@ -305,7 +305,7 b' class localrepository(object):'
305 # required by the tests (or some brave tester)
305 # required by the tests (or some brave tester)
306 if self.ui.configbool('experimental', 'bundle2-exp', False):
306 if self.ui.configbool('experimental', 'bundle2-exp', False):
307 caps = set(caps)
307 caps = set(caps)
308 capsblob = bundle2.encodecaps(bundle2.capabilities)
308 capsblob = bundle2.encodecaps(bundle2.getrepocaps(self))
309 caps.add('bundle2-exp=' + urllib.quote(capsblob))
309 caps.add('bundle2-exp=' + urllib.quote(capsblob))
310 return caps
310 return caps
311
311
@@ -609,7 +609,7 b' def _capabilities(repo, proto):'
609 else:
609 else:
610 caps.append('streamreqs=%s' % ','.join(requiredformats))
610 caps.append('streamreqs=%s' % ','.join(requiredformats))
611 if repo.ui.configbool('experimental', 'bundle2-exp', False):
611 if repo.ui.configbool('experimental', 'bundle2-exp', False):
612 capsblob = bundle2.encodecaps(bundle2.capabilities)
612 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
613 caps.append('bundle2-exp=' + urllib.quote(capsblob))
613 caps.append('bundle2-exp=' + urllib.quote(capsblob))
614 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
614 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
615 caps.append('httpheader=1024')
615 caps.append('httpheader=1024')
General Comments 0
You need to be logged in to leave comments. Login now