Patchwork D7967: exchange: recognize changegroup3 bundles in `getbundlespec()`

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2020, 11:32 p.m.
Message ID <differential-rev-PHID-DREV-6mccun6o2onegah3o6gi-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44565/
State New
Headers show

Comments

phabricator - Jan. 21, 2020, 11:32 p.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, `hg bundle --spec $bundle` complained that changegroup3 didn't have
  a known bundlespec and suggested upgrading the client, even if the same binary
  generated the bundle.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D7967

AFFECTED FILES
  mercurial/exchange.py
  tests/test-lfs-bundle.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 22, 2020, 12:47 p.m.
pulkit added inline comments.
pulkit added subscribers: joerg.sonnenberger, pulkit.

INLINE COMMENTS

> exchange.py:321
> +                ):
> +                    version = b'v2'
>                  else:

Should not this be `v3`? I believe this is what @joerg.sonnenberger is also trying to point out on IRC.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7967/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7967

To: mharbison72, #hg-reviewers
Cc: pulkit, joerg.sonnenberger, mercurial-devel
phabricator - Jan. 22, 2020, 1:04 p.m.
mharbison72 added inline comments.
mharbison72 added a subscriber: marmoute.

INLINE COMMENTS

> pulkit wrote in exchange.py:321
> Should not this be `v3`? I believe this is what @joerg.sonnenberger is also trying to point out on IRC.

I’m not sure now. I think I went this way because I’m pretty sure it complained when I tried to generate a bzip2-v3 bundle.  And since 01 is mapped to v2 and the error message is talking about finding a bundlespec, it seemed like v2 was the only option.  But maybe something is missing elsewhere too.  @marmoute?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7967/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7967

To: mharbison72, #hg-reviewers
Cc: marmoute, pulkit, joerg.sonnenberger, mercurial-devel
phabricator - Jan. 27, 2020, 9:58 a.m.
marmoute added a comment.


  I can confirm the spec version number are different to the changegroup version number. For the rest. I'll try to have a look soon.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7967/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7967

To: mharbison72, #hg-reviewers
Cc: marmoute, pulkit, joerg.sonnenberger, mercurial-devel

Patch

diff --git a/tests/test-lfs-bundle.t b/tests/test-lfs-bundle.t
--- a/tests/test-lfs-bundle.t
+++ b/tests/test-lfs-bundle.t
@@ -95,3 +95,27 @@ 
   OK
   ---- Applying src-lfs.bundle to dst-lfs ----
   OK
+
+  $ for i in $SRCNAMES; do
+  >   echo % test bundle type $i
+  >   hg debugbundle $TESTTMP/$i.bundle
+  >   hg debugbundle --config experimental.changegroup3=True \
+  >                  --spec $TESTTMP/$i.bundle
+  >   echo
+  > done
+  % test bundle type src-normal
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 2, version: 03} (mandatory: True)
+      92a23f1a59ca009ca9631a529d05e020c3873842
+      7ee5ca02c65436e529977365458ef3062cf9f746
+  cache:rev-branch-cache -- {} (mandatory: False)
+  bzip2-v2
+  
+  % test bundle type src-lfs
+  Stream params: {Compression: BZ}
+  changegroup -- {nbchanges: 2, version: 03} (mandatory: True)
+      92a23f1a59ca009ca9631a529d05e020c3873842
+      7ee5ca02c65436e529977365458ef3062cf9f746
+  cache:rev-branch-cache -- {} (mandatory: False)
+  bzip2-v2
+  
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -315,6 +315,10 @@ 
                 version = part.params[b'version']
                 if version in (b'01', b'02'):
                     version = b'v2'
+                elif version == b'03' and ui.configbool(
+                    b'experimental', b'changegroup3'
+                ):
+                    version = b'v2'
                 else:
                     raise error.Abort(
                         _(