[PATCH 3 of 3] bundle2: support pulling from treemanifest bundle

Martin von Zweigbergk martinvonz at google.com
Thu May 4 13:04:13 EDT 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1493771040 25200
#      Tue May 02 17:24:00 2017 -0700
# Node ID fb7b85cae8eeee1e10b5db135083648601807dd1
# Parent  bacf4207522fc9d8ce459d65256925a1e5f7d332
bundle2: support pulling from treemanifest bundle

This makes bundlerepo read the treemanifest parameter from the
changegroup part and update its requirements if the parameter is
present.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -316,6 +316,9 @@
                     if self.bundle.compressed():
                         cgstream = _writetempbundle(part.read,
                                                     ".cg%sun" % version)
+                    if 'treemanifest' in part.params:
+                        self.requirements.add('treemanifest')
+                        self._applyopenerreqs()
 
             if cgstream is None:
                 raise error.Abort(_('No changegroups found'))
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -887,3 +887,14 @@
   adding file changes
   added 4 changesets with 18 changes to 8 files
   (run 'hg update' to get a working copy)
+  $ hg init flat-repo2
+  $ hg --config experimental.changegroup3=yes pull -R flat-repo2 deeprepo.bundle
+  pulling from deeprepo.bundle
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 18 changes to 8 files
+  (run 'hg update' to get a working copy)
+  $ grep treemanifest flat-repo2/.hg/requires
+  treemanifest


More information about the Mercurial-devel mailing list