##// END OF EJS Templates
changegroup: pass end of manifests marker into constructor...
Gregory Szorc -
r38934:67f37e8a default
parent child Browse files
Show More
@@ -521,6 +521,7 b' class revisiondelta(object):'
521
521
522 class cg1packer(object):
522 class cg1packer(object):
523 def __init__(self, repo, filematcher, version, builddeltaheader,
523 def __init__(self, repo, filematcher, version, builddeltaheader,
524 manifestsend,
524 bundlecaps=None):
525 bundlecaps=None):
525 """Given a source repo, construct a bundler.
526 """Given a source repo, construct a bundler.
526
527
@@ -530,6 +531,8 b' class cg1packer(object):'
530 builddeltaheader is a callable that constructs the header for a group
531 builddeltaheader is a callable that constructs the header for a group
531 delta.
532 delta.
532
533
534 manifestsend is a chunk to send after manifests have been fully emitted.
535
533 bundlecaps is optional and can be used to specify the set of
536 bundlecaps is optional and can be used to specify the set of
534 capabilities which can be used to build the bundle. While bundlecaps is
537 capabilities which can be used to build the bundle. While bundlecaps is
535 unused in core Mercurial, extensions rely on this feature to communicate
538 unused in core Mercurial, extensions rely on this feature to communicate
@@ -540,6 +543,7 b' class cg1packer(object):'
540
543
541 self.version = version
544 self.version = version
542 self._builddeltaheader = builddeltaheader
545 self._builddeltaheader = builddeltaheader
546 self._manifestsend = manifestsend
543
547
544 # Set of capabilities we can use to build the bundle.
548 # Set of capabilities we can use to build the bundle.
545 if bundlecaps is None:
549 if bundlecaps is None:
@@ -661,9 +665,6 b' class cg1packer(object):'
661 lookuplinknode, units=_('manifests')):
665 lookuplinknode, units=_('manifests')):
662 yield chunk
666 yield chunk
663
667
664 def _manifestsdone(self):
665 return ''
666
667 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
668 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
668 '''yield a sequence of changegroup chunks (strings)'''
669 '''yield a sequence of changegroup chunks (strings)'''
669 repo = self._repo
670 repo = self._repo
@@ -854,7 +855,7 b' class cg1packer(object):'
854 size += len(x)
855 size += len(x)
855 yield x
856 yield x
856 self._verbosenote(_('%8.i (manifests)\n') % size)
857 self._verbosenote(_('%8.i (manifests)\n') % size)
857 yield self._manifestsdone()
858 yield self._manifestsend
858
859
859 # The 'source' parameter is useful for extensions
860 # The 'source' parameter is useful for extensions
860 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
861 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
@@ -1099,9 +1100,9 b' class cg1packer(object):'
1099
1100
1100 class cg2packer(cg1packer):
1101 class cg2packer(cg1packer):
1101 def __init__(self, repo, filematcher, version, builddeltaheader,
1102 def __init__(self, repo, filematcher, version, builddeltaheader,
1102 bundlecaps=None):
1103 manifestsend, bundlecaps=None):
1103 super(cg2packer, self).__init__(repo, filematcher, version,
1104 super(cg2packer, self).__init__(repo, filematcher, version,
1104 builddeltaheader,
1105 builddeltaheader, manifestsend,
1105 bundlecaps=bundlecaps)
1106 bundlecaps=bundlecaps)
1106
1107
1107 if self._reorder is None:
1108 if self._reorder is None:
@@ -1159,14 +1160,12 b' class cg3packer(cg2packer):'
1159 units=_('manifests')):
1160 units=_('manifests')):
1160 yield chunk
1161 yield chunk
1161
1162
1162 def _manifestsdone(self):
1163 return self.close()
1164
1165 def _makecg1packer(repo, filematcher, bundlecaps):
1163 def _makecg1packer(repo, filematcher, bundlecaps):
1166 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
1164 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
1167 d.node, d.p1node, d.p2node, d.linknode)
1165 d.node, d.p1node, d.p2node, d.linknode)
1168
1166
1169 return cg1packer(repo, filematcher, b'01', builddeltaheader,
1167 return cg1packer(repo, filematcher, b'01', builddeltaheader,
1168 manifestsend=b'',
1170 bundlecaps=bundlecaps)
1169 bundlecaps=bundlecaps)
1171
1170
1172 def _makecg2packer(repo, filematcher, bundlecaps):
1171 def _makecg2packer(repo, filematcher, bundlecaps):
@@ -1174,6 +1173,7 b' def _makecg2packer(repo, filematcher, bu'
1174 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
1173 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
1175
1174
1176 return cg2packer(repo, filematcher, b'02', builddeltaheader,
1175 return cg2packer(repo, filematcher, b'02', builddeltaheader,
1176 manifestsend=b'',
1177 bundlecaps=bundlecaps)
1177 bundlecaps=bundlecaps)
1178
1178
1179 def _makecg3packer(repo, filematcher, bundlecaps):
1179 def _makecg3packer(repo, filematcher, bundlecaps):
@@ -1181,6 +1181,7 b' def _makecg3packer(repo, filematcher, bu'
1181 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
1181 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
1182
1182
1183 return cg3packer(repo, filematcher, b'03', builddeltaheader,
1183 return cg3packer(repo, filematcher, b'03', builddeltaheader,
1184 manifestsend=closechunk(),
1184 bundlecaps=bundlecaps)
1185 bundlecaps=bundlecaps)
1185
1186
1186 _packermap = {'01': (_makecg1packer, cg1unpacker),
1187 _packermap = {'01': (_makecg1packer, cg1unpacker),
General Comments 0
You need to be logged in to leave comments. Login now