diff 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
line wrap: on
line diff
--- a/mercurial/bundle2.py	Wed Jan 13 15:47:37 2016 -0600
+++ b/mercurial/bundle2.py	Tue Jan 12 21:01:06 2016 -0800
@@ -1240,7 +1240,7 @@
     Exists to allow extensions (like evolution) to mutate the capabilities.
     """
     caps = capabilities.copy()
-    caps['changegroup'] = tuple(sorted(changegroup.packermap.keys()))
+    caps['changegroup'] = tuple(sorted(changegroup.supportedversions(repo)))
     if obsolete.isenabled(repo, obsolete.exchangeopt):
         supportedformat = tuple('V%i' % v for v in obsolete.formats)
         caps['obsmarkers'] = supportedformat
@@ -1277,8 +1277,7 @@
     op.gettransaction()
     unpackerversion = inpart.params.get('version', '01')
     # We should raise an appropriate exception here
-    unpacker = changegroup.packermap[unpackerversion][1]
-    cg = unpacker(inpart, None)
+    cg = changegroup.getunbundler(unpackerversion, inpart, None)
     # the source and url passed here are overwritten by the one contained in
     # the transaction.hookargs argument. So 'bundle2' is a placeholder
     nbchangesets = None