D1955: bundlespec: add support for some variants
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa2b350d9f6ae: bundlespec: add support for some variants (authored by lothiraldan, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1955?vs=7377=7386 REVISION DETAIL https://phab.mercurial-scm.org/D1955 AFFECTED FILES mercurial/exchange.py tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -41,15 +41,8 @@ > EOF $ hg bundle -a --type="none-v2;stream=v2" bundle.hg - 5 changesets found $ hg debugbundle bundle.hg Stream params: {} - changegroup -- {nbchanges: 5, version: 02} - 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 - 112478962961147124edd43549aedd1a335e44bf - 26805aba1e600a82e93661149f2313866a221a7b - f585351a92f85104bff7c284233c338b10eb1df7 - 9bc730a19041f9ec7cb33c626e811aa233efb18c - cache:rev-branch-cache -- {} + stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore} $ hg debugbundle --spec bundle.hg - none-v2 + none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -76,6 +76,10 @@ } _bundlespeccontentopts['bundle2'] = _bundlespeccontentopts['v2'] +_bundlespecvariants = {"streamv2": {"changegroup": False, "streamv2": True, +"tagsfnodescache": False, +"revbranchcache": False}} + # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE. _bundlespecv1compengines = {'gzip', 'bzip2', 'none'} @@ -206,6 +210,11 @@ # Compute contentopts based on the version contentopts = _bundlespeccontentopts.get(version, {}).copy() +# Process the variants +if "stream" in params and params["stream"] == "v2": +variant = _bundlespecvariants["streamv2"] +contentopts.update(variant) + if not externalnames: engine = util.compengines.forbundlename(compression) compression = engine.bundletype()[1] @@ -281,6 +290,13 @@ 'a known bundlespec') % version, hint=_('try upgrading your Mercurial ' 'client')) +elif part.type == 'stream2' and version is None: +# A stream2 part requires to be part of a v2 bundle +version = "v2" +requirements = urlreq.unquote(part.params['requirements']) +splitted = requirements.split() +params = bundle2._formatrequirementsparams(splitted) +return 'none-v2;stream=v2;%s' % params if not version: raise error.Abort(_('could not identify changegroup version in ' To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1955: bundlespec: add support for some variants
lothiraldan updated this revision to Diff 7377. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1955?vs=5027=7377 REVISION DETAIL https://phab.mercurial-scm.org/D1955 AFFECTED FILES mercurial/exchange.py tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -41,15 +41,8 @@ > EOF $ hg bundle -a --type="none-v2;stream=v2" bundle.hg - 5 changesets found $ hg debugbundle bundle.hg Stream params: {} - changegroup -- {nbchanges: 5, version: 02} - 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 - 112478962961147124edd43549aedd1a335e44bf - 26805aba1e600a82e93661149f2313866a221a7b - f585351a92f85104bff7c284233c338b10eb1df7 - 9bc730a19041f9ec7cb33c626e811aa233efb18c - cache:rev-branch-cache -- {} + stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore} $ hg debugbundle --spec bundle.hg - none-v2 + none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -76,6 +76,10 @@ } _bundlespeccontentopts['bundle2'] = _bundlespeccontentopts['v2'] +_bundlespecvariants = {"streamv2": {"changegroup": False, "streamv2": True, +"tagsfnodescache": False, +"revbranchcache": False}} + # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE. _bundlespecv1compengines = {'gzip', 'bzip2', 'none'} @@ -206,6 +210,11 @@ # Compute contentopts based on the version contentopts = _bundlespeccontentopts.get(version, {}).copy() +# Process the variants +if "stream" in params and params["stream"] == "v2": +variant = _bundlespecvariants["streamv2"] +contentopts.update(variant) + if not externalnames: engine = util.compengines.forbundlename(compression) compression = engine.bundletype()[1] @@ -281,6 +290,13 @@ 'a known bundlespec') % version, hint=_('try upgrading your Mercurial ' 'client')) +elif part.type == 'stream2' and version is None: +# A stream2 part requires to be part of a v2 bundle +version = "v2" +requirements = urlreq.unquote(part.params['requirements']) +splitted = requirements.split() +params = bundle2._formatrequirementsparams(splitted) +return 'none-v2;stream=v2;%s' % params if not version: raise error.Abort(_('could not identify changegroup version in ' To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1955: bundlespec: add support for some variants
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. This looks reasonable to me. I'll hold off landing due to requirements on an earlier, not yet accepted patch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1955 To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1955: bundlespec: add support for some variants
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This way the stream v2 bundle spec can disable the changegroup part while enabling the stream v2 part. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1955 AFFECTED FILES mercurial/exchange.py tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -41,14 +41,8 @@ > EOF $ hg bundle -a --type="none-v2;stream=v2" bundle.hg - 5 changesets found $ hg debugbundle bundle.hg Stream params: {} - changegroup -- {nbchanges: 5, version: 02} - 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 - 112478962961147124edd43549aedd1a335e44bf - 26805aba1e600a82e93661149f2313866a221a7b - f585351a92f85104bff7c284233c338b10eb1df7 - 9bc730a19041f9ec7cb33c626e811aa233efb18c + stream2 -- {bytecount: 1693, filecount: 11, requirements: dotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore} $ hg debugbundle --spec bundle.hg - none-v2 + none-v2;stream=v2;requirements%3Ddotencode%2Cfncache%2Cgeneraldelta%2Crevlogv1%2Cstore diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -60,6 +60,8 @@ } } +_bundlespecvariants = {"streamv2": {"changegroup": False, "streamv2": True}} + # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE. _bundlespecv1compengines = {'gzip', 'bzip2', 'none'} @@ -180,8 +182,14 @@ ', '.join(sorted(missingreqs))) # Compute contentops based on the version + contentops = _bundlespeccontentops.get(version, {}).copy() +# Process the variants +if "stream" in params and params["stream"] == "v2": +variant = _bundlespecvariants["streamv2"] +contentops.update(variant) + if not externalnames: engine = util.compengines.forbundlename(compression) compression = engine.bundletype()[1] @@ -268,6 +276,12 @@ 'a known bundlespec') % version, hint=_('try upgrading your Mercurial ' 'client')) +elif part.type == 'stream2' and version is None: +# A stream2 part requires to be part of a v2 bundle +version = "v2" +requirements = urlreq.unquote(part.params['requirements']) +params = _formatrequirementsparams(requirements.split()) +return 'none-v2;stream=v2;%s' % params if not version: raise error.Abort(_('could not identify changegroup version in ' To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel