Patchwork D1954: bundle: add the possibility to bundle a stream v2 part

login
register
mail settings
Submitter phabricator
Date Jan. 31, 2018, 4:25 p.m.
Message ID <differential-rev-PHID-DREV-hqbsdqqjwz5xnaxq4xch-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27090/
State New
Headers show

Comments

phabricator - Jan. 31, 2018, 4:25 p.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 2, 2018, 9:33 a.m.
lothiraldan added a comment.


  Now that we have more time to review this series, this is the part I am the least comfortable with. I think we could/should extract the stream part generator somewhere else than exchange.py. Maybe bundle2.py directly but I'm not sure. Any ideas?

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1601,6 +1601,16 @@ 
         phasedata = phases.binaryencode(headsbyphase)
         bundler.newpart('phase-heads', data=phasedata)
 
+    if opts.get('streamv2', False):
+        # The generation of the stream part is currently in exchange but
+        # importing exchange create an import cycle. We could extract the
+        # generation of the stream part in bundle2 or another file.
+        from . import exchange
+        # The streamv2 part doesn't uses the source argument, we can refactor
+        # this once the bundle part generator has been extracted
+        source = None
+        exchange._getbundlestream2(bundler, repo, source, stream=True)
+
 def addparttagsfnodescache(repo, bundler, outgoing):
     # we include the tags fnode cache for the bundle changeset
     # (as an optional parts)