D4080: changegroup: pass end of manifests marker into constructor

2018-08-06 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG67f37e8a5490: changegroup: pass end of manifests marker 
into constructor (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4080?vs=9842=9957

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -521,6 +521,7 @@
 
 class cg1packer(object):
 def __init__(self, repo, filematcher, version, builddeltaheader,
+ manifestsend,
  bundlecaps=None):
 """Given a source repo, construct a bundler.
 
@@ -530,6 +531,8 @@
 builddeltaheader is a callable that constructs the header for a group
 delta.
 
+manifestsend is a chunk to send after manifests have been fully 
emitted.
+
 bundlecaps is optional and can be used to specify the set of
 capabilities which can be used to build the bundle. While bundlecaps is
 unused in core Mercurial, extensions rely on this feature to 
communicate
@@ -540,6 +543,7 @@
 
 self.version = version
 self._builddeltaheader = builddeltaheader
+self._manifestsend = manifestsend
 
 # Set of capabilities we can use to build the bundle.
 if bundlecaps is None:
@@ -661,9 +665,6 @@
 lookuplinknode, units=_('manifests')):
 yield chunk
 
-def _manifestsdone(self):
-return ''
-
 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
 '''yield a sequence of changegroup chunks (strings)'''
 repo = self._repo
@@ -854,7 +855,7 @@
 size += len(x)
 yield x
 self._verbosenote(_('%8.i (manifests)\n') % size)
-yield self._manifestsdone()
+yield self._manifestsend
 
 # The 'source' parameter is useful for extensions
 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
@@ -1099,9 +1100,9 @@
 
 class cg2packer(cg1packer):
 def __init__(self, repo, filematcher, version, builddeltaheader,
- bundlecaps=None):
+ manifestsend, bundlecaps=None):
 super(cg2packer, self).__init__(repo, filematcher, version,
-builddeltaheader,
+builddeltaheader, manifestsend,
 bundlecaps=bundlecaps)
 
 if self._reorder is None:
@@ -1159,28 +1160,28 @@
 units=_('manifests')):
 yield chunk
 
-def _manifestsdone(self):
-return self.close()
-
 def _makecg1packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.linknode)
 
 return cg1packer(repo, filematcher, b'01', builddeltaheader,
+ manifestsend=b'',
  bundlecaps=bundlecaps)
 
 def _makecg2packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV2_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
 
 return cg2packer(repo, filematcher, b'02', builddeltaheader,
+ manifestsend=b'',
  bundlecaps=bundlecaps)
 
 def _makecg3packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV3_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
 
 return cg3packer(repo, filematcher, b'03', builddeltaheader,
+ manifestsend=closechunk(),
  bundlecaps=bundlecaps)
 
 _packermap = {'01': (_makecg1packer, cg1unpacker),



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4080: changegroup: pass end of manifests marker into constructor

2018-08-03 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  cg3 inserts a custom marker in the stream once all manifests
  have been transferred. This is currently abstracted out by
  overriding a method.
  
  Let's pass the end of manifests marker in as an argument to avoid
  the extra method.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -524,6 +524,7 @@
 
 class cg1packer(object):
 def __init__(self, repo, filematcher, version, builddeltaheader,
+ manifestsend,
  bundlecaps=None):
 """Given a source repo, construct a bundler.
 
@@ -533,6 +534,8 @@
 builddeltaheader is a callable that constructs the header for a group
 delta.
 
+manifestsend is a chunk to send after manifests have been fully 
emitted.
+
 bundlecaps is optional and can be used to specify the set of
 capabilities which can be used to build the bundle. While bundlecaps is
 unused in core Mercurial, extensions rely on this feature to 
communicate
@@ -543,6 +546,7 @@
 
 self.version = version
 self._builddeltaheader = builddeltaheader
+self._manifestsend = manifestsend
 
 # Set of capabilities we can use to build the bundle.
 if bundlecaps is None:
@@ -664,9 +668,6 @@
 lookuplinknode, units=_('manifests')):
 yield chunk
 
-def _manifestsdone(self):
-return ''
-
 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
 '''yield a sequence of changegroup chunks (strings)'''
 repo = self._repo
@@ -857,7 +858,7 @@
 size += len(x)
 yield x
 self._verbosenote(_('%8.i (manifests)\n') % size)
-yield self._manifestsdone()
+yield self._manifestsend
 
 # The 'source' parameter is useful for extensions
 def generatefiles(self, changedfiles, linknodes, commonrevs, source):
@@ -1102,9 +1103,9 @@
 
 class cg2packer(cg1packer):
 def __init__(self, repo, filematcher, version, builddeltaheader,
- bundlecaps=None):
+ manifestsend, bundlecaps=None):
 super(cg2packer, self).__init__(repo, filematcher, version,
-builddeltaheader,
+builddeltaheader, manifestsend,
 bundlecaps=bundlecaps)
 
 if self._reorder is None:
@@ -1162,28 +1163,28 @@
 units=_('manifests')):
 yield chunk
 
-def _manifestsdone(self):
-return self.close()
-
 def _makecg1packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV1_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.linknode)
 
 return cg1packer(repo, filematcher, b'01', builddeltaheader,
+ manifestsend=b'',
  bundlecaps=bundlecaps)
 
 def _makecg2packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV2_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.basenode, d.linknode)
 
 return cg2packer(repo, filematcher, b'02', builddeltaheader,
+ manifestsend=b'',
  bundlecaps=bundlecaps)
 
 def _makecg3packer(repo, filematcher, bundlecaps):
 builddeltaheader = lambda d: _CHANGEGROUPV3_DELTA_HEADER.pack(
 d.node, d.p1node, d.p2node, d.basenode, d.linknode, d.flags)
 
 return cg3packer(repo, filematcher, b'03', builddeltaheader,
+ manifestsend=closechunk(),
  bundlecaps=bundlecaps)
 
 _packermap = {'01': (_makecg1packer, cg1unpacker),



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel