Patchwork D4076: changegroup: define functions for creating changegroup packers

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2018, 6:56 a.m.
Message ID <5c913a916ef0a3e0ce12e46debf7f730@localhost.localdomain>
Download mbox | patch
Permalink /patch/33296/
State Not Applicable
Headers show

Comments

phabricator - Aug. 6, 2018, 6:56 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG19344024a8e1: changegroup: define functions for creating changegroup packers (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4076?vs=9838&id=9952

REVISION DETAIL
  https://phab.mercurial-scm.org/D4076

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -1176,11 +1176,20 @@ 
         return struct.pack(
             self.deltaheader, node, p1n, p2n, basenode, linknode, flags)
 
-_packermap = {'01': (cg1packer, cg1unpacker),
+def _makecg1packer(repo, filematcher, bundlecaps):
+    return cg1packer(repo, filematcher, bundlecaps=bundlecaps)
+
+def _makecg2packer(repo, filematcher, bundlecaps):
+    return cg2packer(repo, filematcher, bundlecaps=bundlecaps)
+
+def _makecg3packer(repo, filematcher, bundlecaps):
+    return cg3packer(repo, filematcher, bundlecaps=bundlecaps)
+
+_packermap = {'01': (_makecg1packer, cg1unpacker),
              # cg2 adds support for exchanging generaldelta
-             '02': (cg2packer, cg2unpacker),
+             '02': (_makecg2packer, cg2unpacker),
              # cg3 adds support for exchanging revlog flags and treemanifests
-             '03': (cg3packer, cg3unpacker),
+             '03': (_makecg3packer, cg3unpacker),
 }
 
 def allsupportedversions(repo):
@@ -1249,8 +1258,8 @@ 
     filematcher = matchmod.intersectmatchers(repo.narrowmatch(),
                                              filematcher)
 
-    return _packermap[version][0](repo, filematcher=filematcher,
-                                  bundlecaps=bundlecaps)
+    fn = _packermap[version][0]
+    return fn(repo, filematcher, bundlecaps)
 
 def getunbundler(version, fh, alg, extras=None):
     return _packermap[version][1](fh, alg, extras=extras)