comparison mercurial/bundle2.py @ 27751:a40e2f7fe49d

changegroup: hide packermap behind methods This is to prepare for hiding changegroup3 behind a config option.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 12 Jan 2016 21:01:06 -0800
parents 5c0fd878779c
children 52a4ad62b006
comparison
equal deleted inserted replaced
27750:443848eece18 27751:a40e2f7fe49d
1238 """return the bundle2 capabilities for a given repo 1238 """return the bundle2 capabilities for a given repo
1239 1239
1240 Exists to allow extensions (like evolution) to mutate the capabilities. 1240 Exists to allow extensions (like evolution) to mutate the capabilities.
1241 """ 1241 """
1242 caps = capabilities.copy() 1242 caps = capabilities.copy()
1243 caps['changegroup'] = tuple(sorted(changegroup.packermap.keys())) 1243 caps['changegroup'] = tuple(sorted(changegroup.supportedversions(repo)))
1244 if obsolete.isenabled(repo, obsolete.exchangeopt): 1244 if obsolete.isenabled(repo, obsolete.exchangeopt):
1245 supportedformat = tuple('V%i' % v for v in obsolete.formats) 1245 supportedformat = tuple('V%i' % v for v in obsolete.formats)
1246 caps['obsmarkers'] = supportedformat 1246 caps['obsmarkers'] = supportedformat
1247 if allowpushback: 1247 if allowpushback:
1248 caps['pushback'] = () 1248 caps['pushback'] = ()
1275 # we need to make sure we trigger the creation of a transaction object used 1275 # we need to make sure we trigger the creation of a transaction object used
1276 # for the whole processing scope. 1276 # for the whole processing scope.
1277 op.gettransaction() 1277 op.gettransaction()
1278 unpackerversion = inpart.params.get('version', '01') 1278 unpackerversion = inpart.params.get('version', '01')
1279 # We should raise an appropriate exception here 1279 # We should raise an appropriate exception here
1280 unpacker = changegroup.packermap[unpackerversion][1] 1280 cg = changegroup.getunbundler(unpackerversion, inpart, None)
1281 cg = unpacker(inpart, None)
1282 # the source and url passed here are overwritten by the one contained in 1281 # the source and url passed here are overwritten by the one contained in
1283 # the transaction.hookargs argument. So 'bundle2' is a placeholder 1282 # the transaction.hookargs argument. So 'bundle2' is a placeholder
1284 nbchangesets = None 1283 nbchangesets = None
1285 if 'nbchanges' in inpart.params: 1284 if 'nbchanges' in inpart.params:
1286 nbchangesets = int(inpart.params.get('nbchanges')) 1285 nbchangesets = int(inpart.params.get('nbchanges'))