Patchwork [STABLE,v2] exchange: set 'treemanifest' param on pushed changegroups too

login
register
mail settings
Submitter Martin von Zweigbergk
Date Jan. 25, 2016, 9:16 p.m.
Message ID <5f090f475ac4b81942a6.1453756577@waste.org>
Download mbox | patch
Permalink /patch/12885/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Jan. 25, 2016, 9:16 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1453509110 28800
#      Fri Jan 22 16:31:50 2016 -0800
# Branch stable
# Node ID 5f090f475ac4b81942a67cabbc72e8bea02ac4b7
# Parent  1779ff7426c9ef1605e6e1fdb9994a4c836fc459
exchange: set 'treemanifest' param on pushed changegroups too

In 5c0fd878779c (treemanifests: set bundle2 part parameter indicating
treemanifest, 2016-01-08), I didn't realize I had to set the parameter
separately for getbundle and unbundle. Having the parameter there on
push allows us to push to an empty repo and have the requirements
updated correctly.
Matt Mackall - Jan. 25, 2016, 11:22 p.m.
On Mon, 2016-01-25 at 15:16 -0600, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1453509110 28800
> #      Fri Jan 22 16:31:50 2016 -0800
> # Branch stable
> # Node ID 5f090f475ac4b81942a67cabbc72e8bea02ac4b7
> # Parent  1779ff7426c9ef1605e6e1fdb9994a4c836fc459
> exchange: set 'treemanifest' param on pushed changegroups too

Queued for stable, thanks.

-- 
Mathematics is the supreme nostalgia of our time.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -717,6 +717,8 @@ 
     cgpart = bundler.newpart('changegroup', data=cg)
     if version is not None:
         cgpart.addparam('version', version)
+    if 'treemanifest' in pushop.repo.requirements:
+        cgpart.addparam('treemanifest', '1')
     def handlereply(op):
         """extract addchangegroup returns from server reply"""
         cgreplies = op.records.getreplies(cgpart.id)
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -312,9 +312,28 @@ 
    1
   +foo
 
+Pushing from treemanifest repo to an empty repo makes that a treemanifest repo
+
+  $ cd ..
+  $ hg init empty-repo
+  $ cat << EOF >> empty-repo/.hg/hgrc
+  > [experimental]
+  > changegroup3=yes
+  > EOF
+  $ grep treemanifest empty-repo/.hg/requires
+  [1]
+  $ hg push -R repo -r 0 empty-repo
+  pushing to empty-repo
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 2 changes to 2 files
+  $ grep treemanifest empty-repo/.hg/requires
+  treemanifest
+
 Create deeper repo with tree manifests.
 
-  $ cd ..
   $ hg --config experimental.treemanifest=True init deeprepo
   $ cd deeprepo