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

login
register
mail settings
Submitter Martin von Zweigbergk
Date Jan. 23, 2016, 1:15 a.m.
Message ID <4aabe694f4ee90ac9000.1453511748@waste.org>
Download mbox | patch
Permalink /patch/12874/
State Superseded
Headers show

Comments

Martin von Zweigbergk - Jan. 23, 2016, 1:15 a.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 4aabe694f4ee90ac9000adbf9cae2b328cd4ec6d
# Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
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.
Martin von Zweigbergk - Jan. 23, 2016, 1:17 a.m.
This will conflict with my changes already on the clowncopter, but simply
concatenating the hunks will work. Sorry about the trouble.

On Fri, Jan 22, 2016 at 5:16 PM Martin von Zweigbergk <martinvonz@google.com>
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 4aabe694f4ee90ac9000adbf9cae2b328cd4ec6d
> # Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
> 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.
>
> 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
> @@ -285,6 +285,26 @@
>         1       127     111      0       5 25ecb8cb8618 000000000000
> 000000000000
>         2       238      55      1       6 5b16163a30c6 25ecb8cb8618
> 000000000000
>
> +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 ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
>
Martin von Zweigbergk - Jan. 23, 2016, 1:23 a.m.
On Fri, Jan 22, 2016 at 5:17 PM Martin von Zweigbergk <martinvonz@google.com>
wrote:

> This will conflict with my changes already on the clowncopter, but simply
> concatenating the hunks will work. Sorry about the trouble.
>
> On Fri, Jan 22, 2016 at 5:16 PM Martin von Zweigbergk <
> martinvonz@google.com> 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 4aabe694f4ee90ac9000adbf9cae2b328cd4ec6d
>> # Parent  4c6053a6b17d682b34fb88bbeb5e94ed9085d900
>> 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.
>>
>> 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
>> @@ -285,6 +285,26 @@
>>         1       127     111      0       5 25ecb8cb8618 000000000000
>> 000000000000
>>         2       238      55      1       6 5b16163a30c6 25ecb8cb8618
>> 000000000000
>>
>> +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 ..
>>
>
...and this last line in the context should have been removed (unrelated to
the conflict). It's probably best if I just resend when my clowncopter
patches have landed in Matt's repo.

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
@@ -285,6 +285,26 @@ 
        1       127     111      0       5 25ecb8cb8618 000000000000 000000000000
        2       238      55      1       6 5b16163a30c6 25ecb8cb8618 000000000000
 
+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 ..