Patchwork [2,of,3] bundle2: add 'treemanifest' parameter to treemanifest bundles

login
register
mail settings
Submitter via Mercurial-devel
Date May 4, 2017, 5:04 p.m.
Message ID <bacf4207522fc9d8ce45.1493917452@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20429/
State Changes Requested
Headers show

Comments

via Mercurial-devel - May 4, 2017, 5:04 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1493771018 25200
#      Tue May 02 17:23:38 2017 -0700
# Node ID bacf4207522fc9d8ce459d65256925a1e5f7d332
# Parent  f4b255ff67d05e329cc3d80ce1552f30005f58e9
bundle2: add 'treemanifest' parameter to treemanifest bundles

No one cares about the parameter yet, so it makes no difference in
practice, but we will soon start caring.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1360,6 +1360,8 @@ 
         if 'clcount' in cg.extras:
             part.addparam('nbchanges', str(cg.extras['clcount']),
                           mandatory=False)
+        if 'treemanifest' in cg.extras:
+            part.addparam('treemanifest', cg.extras['treemanifest'])
         chunkiter = bundle.getchunks()
     else:
         # compression argument is only for the bundle2 case
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -936,8 +936,11 @@ 
 
 def getsubset(repo, outgoing, bundler, source, fastpath=False):
     gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath)
+    extras = {'clcount': len(outgoing.missing)}
+    if 'treemanifest' in repo.requirements:
+        extras['treemanifest'] = '1'
     return getunbundler(bundler.version, util.chunkbuffer(gengroup), None,
-                        {'clcount': len(outgoing.missing)})
+                        extras)
 
 def changegroupsubset(repo, roots, heads, source, version='01'):
     """Compute a changegroup consisting of all the nodes that are
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -875,7 +875,7 @@ 
   4 changesets found
   $ hg debugbundle deeprepo.bundle
   Stream params: sortdict([('Compression', 'BZ')])
-  changegroup -- "sortdict([('version', '03'), ('nbchanges', '4')])"
+  changegroup -- "sortdict([('version', '03'), ('treemanifest', '1'), ('nbchanges', '4')])"
       775704be6f529df4abf056a4644c866bd6dd6d3e
       726ec8fc7e58ec32b0049698008851c6040abfa2
       5a87d5a8da90c45b84639c95eb188b70f5b40a4e