Patchwork D1951: bundle: condition the changegroup part when creating a new bundle

login
register
mail settings
Submitter phabricator
Date March 19, 2018, 8:19 p.m.
Message ID <0e043c395f6b820c6f774bc9e95f19fd@localhost.localdomain>
Download mbox | patch
Permalink /patch/29643/
State Not Applicable
Headers show

Comments

phabricator - March 19, 2018, 8:19 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG66c0ff381cfc: bundle: condition the changegroup part when creating a new bundle (authored by lothiraldan, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D1951?vs=5150&id=7129#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1951?vs=5150&id=7129

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

AFFECTED FILES
  mercurial/bundle2.py
  mercurial/commands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1263,7 +1263,7 @@ 
         compopts['level'] = complevel
 
 
-    contentopts = {'cg.version': cgversion}
+    contentopts = {'cg.version': cgversion, 'changegroup': True}
     if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'):
         contentopts['obsolescence'] = True
     if repo.ui.configbool('experimental', 'bundle-phases'):
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1577,19 +1577,21 @@ 
     # different right now. So we keep them separated for now for the sake of
     # simplicity.
 
-    # we always want a changegroup in such bundle
-    cgversion = opts.get('cg.version')
-    if cgversion is None:
-        cgversion = changegroup.safeversion(repo)
-    cg = changegroup.makechangegroup(repo, outgoing, cgversion, source)
-    part = bundler.newpart('changegroup', data=cg.getchunks())
-    part.addparam('version', cg.version)
-    if 'clcount' in cg.extras:
-        part.addparam('nbchanges', '%d' % cg.extras['clcount'],
-                      mandatory=False)
-    if opts.get('phases') and repo.revs('%ln and secret()',
-                                        outgoing.missingheads):
-        part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
+    # we might not always want a changegroup in such bundle, for example in
+    # stream bundles
+    if opts.get('changegroup', True):
+        cgversion = opts.get('cg.version')
+        if cgversion is None:
+            cgversion = changegroup.safeversion(repo)
+        cg = changegroup.makechangegroup(repo, outgoing, cgversion, source)
+        part = bundler.newpart('changegroup', data=cg.getchunks())
+        part.addparam('version', cg.version)
+        if 'clcount' in cg.extras:
+            part.addparam('nbchanges', '%d' % cg.extras['clcount'],
+                          mandatory=False)
+        if opts.get('phases') and repo.revs('%ln and secret()',
+                                            outgoing.missingheads):
+            part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
 
     addparttagsfnodescache(repo, bundler, outgoing)
     addpartrevbranchcache(repo, bundler, outgoing)