Patchwork [3,of,3] bundle2: support pulling from treemanifest bundle

login
register
mail settings
Submitter via Mercurial-devel
Date May 4, 2017, 5:04 p.m.
Message ID <fb7b85cae8eeee1e10b5.1493917453@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20430/
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 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.

Patch

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