##// END OF EJS Templates
exchange: refactor control flow of _getbundlechangegrouppart()...
Gregory Szorc -
r38828:afb442f5 default
parent child Browse files
Show More
@@ -2096,30 +2096,34 b' def _getbundlestream2(bundler, repo, *ar'
2096 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
2096 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
2097 b2caps=None, heads=None, common=None, **kwargs):
2097 b2caps=None, heads=None, common=None, **kwargs):
2098 """add a changegroup part to the requested bundle"""
2098 """add a changegroup part to the requested bundle"""
2099 cgstream = None
2099 if not kwargs.get(r'cg', True):
2100 if kwargs.get(r'cg', True):
2100 return
2101 # build changegroup bundle here.
2101
2102 version = '01'
2102 version = '01'
2103 cgversions = b2caps.get('changegroup')
2103 cgversions = b2caps.get('changegroup')
2104 if cgversions: # 3.1 and 3.2 ship with an empty value
2104 if cgversions: # 3.1 and 3.2 ship with an empty value
2105 cgversions = [v for v in cgversions
2105 cgversions = [v for v in cgversions
2106 if v in changegroup.supportedoutgoingversions(repo)]
2106 if v in changegroup.supportedoutgoingversions(repo)]
2107 if not cgversions:
2107 if not cgversions:
2108 raise ValueError(_('no common changegroup version'))
2108 raise ValueError(_('no common changegroup version'))
2109 version = max(cgversions)
2109 version = max(cgversions)
2110 outgoing = _computeoutgoing(repo, heads, common)
2111 if outgoing.missing:
2112 cgstream = changegroup.makestream(repo, outgoing, version, source,
2113 bundlecaps=bundlecaps)
2114
2110
2115 if cgstream:
2111 outgoing = _computeoutgoing(repo, heads, common)
2116 part = bundler.newpart('changegroup', data=cgstream)
2112 if not outgoing.missing:
2117 if cgversions:
2113 return
2118 part.addparam('version', version)
2114
2119 part.addparam('nbchanges', '%d' % len(outgoing.missing),
2115 cgstream = changegroup.makestream(repo, outgoing, version, source,
2120 mandatory=False)
2116 bundlecaps=bundlecaps)
2121 if 'treemanifest' in repo.requirements:
2117
2122 part.addparam('treemanifest', '1')
2118 part = bundler.newpart('changegroup', data=cgstream)
2119 if cgversions:
2120 part.addparam('version', version)
2121
2122 part.addparam('nbchanges', '%d' % len(outgoing.missing),
2123 mandatory=False)
2124
2125 if 'treemanifest' in repo.requirements:
2126 part.addparam('treemanifest', '1')
2123
2127
2124 @getbundle2partsgenerator('bookmarks')
2128 @getbundle2partsgenerator('bookmarks')
2125 def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,
2129 def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,
General Comments 0
You need to be logged in to leave comments. Login now