##// END OF EJS Templates
wireproto: move wireproto capabilities computation in a subfunction...
Pierre-Yves David -
r20775:982f13be default
parent child Browse files
Show More
@@ -417,7 +417,17 def branches(repo, proto, nodes):
417
417
418 wireprotocaps = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey',
418 wireprotocaps = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey',
419 'known', 'getbundle', 'unbundlehash', 'batch']
419 'known', 'getbundle', 'unbundlehash', 'batch']
420 def capabilities(repo, proto):
420
421 def _capabilities(repo, proto):
422 """return a list of capabilities for a repo
423
424 This function exists to allow extensions to easily wrap capabilities
425 computation
426
427 - returns a lists: easy to alter
428 - change done here will be propagated to both `capabilities` and `hello`
429 command without any other effort. without any other action needed.
430 """
421 # copy to prevent modification of the global list
431 # copy to prevent modification of the global list
422 caps = list(wireprotocaps)
432 caps = list(wireprotocaps)
423 if _allowstream(repo.ui):
433 if _allowstream(repo.ui):
@@ -432,7 +442,12 def capabilities(repo, proto):
432 caps.append('streamreqs=%s' % ','.join(requiredformats))
442 caps.append('streamreqs=%s' % ','.join(requiredformats))
433 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
443 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
434 caps.append('httpheader=1024')
444 caps.append('httpheader=1024')
435 return ' '.join(caps)
445 return caps
446
447 # If you are writting and extension and consider wrapping this function. Wrap
448 # `_capabilities` instead.
449 def capabilities(repo, proto):
450 return ' '.join(_capabilities(repo, proto))
436
451
437 def changegroup(repo, proto, roots):
452 def changegroup(repo, proto, roots):
438 nodes = decodelist(roots)
453 nodes = decodelist(roots)
General Comments 0
You need to be logged in to leave comments. Login now