[Request] [+- ] D8480: bundle2: make obsolescence parts optional
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Fri Apr 24 15:24:19 UTC 2020
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
It is useful to ship obsolescence markers as part of clonebundles or
pullbundles, but they shouldn't stop a non-evolution client from
working. Marking the part as optional is enough to ensure this.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D8480
AFFECTED FILES
mercurial/bundle2.py
tests/test-obsolete-bundle-strip.t
tests/test-obsolete-changeset-exchange.t
tests/test-obsolete.t
CHANGE DETAILS
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1632,7 +1632,7 @@
e016b03fd86fcccc54817d120b90b751aaf367d6
b0551702f918510f01ae838ab03a463054c67b46
cache:rev-branch-cache -- {} (mandatory: False)
- obsmarkers -- {} (mandatory: True)
+ obsmarkers -- {} (mandatory: False)
version: 1 (92 bytes)
e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
phase-heads -- {} (mandatory: True)
diff --git a/tests/test-obsolete-changeset-exchange.t b/tests/test-obsolete-changeset-exchange.t
--- a/tests/test-obsolete-changeset-exchange.t
+++ b/tests/test-obsolete-changeset-exchange.t
@@ -103,7 +103,7 @@
changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
f89bcc95eba5174b1ccc3e33a82e84c96e8338ee
cache:rev-branch-cache -- {} (mandatory: False)
- obsmarkers -- {} (mandatory: True)
+ obsmarkers -- {} (mandatory: False)
version: 1 (70 bytes)
9d73aac1b2ed7d53835eaeec212ed41ea47da53a f89bcc95eba5174b1ccc3e33a82e84c96e8338ee 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
diff --git a/tests/test-obsolete-bundle-strip.t b/tests/test-obsolete-bundle-strip.t
--- a/tests/test-obsolete-bundle-strip.t
+++ b/tests/test-obsolete-bundle-strip.t
@@ -1444,3 +1444,35 @@
# unbundling: new changesets 9ac430e15fca (1 drafts)
# unbundling: (1 other changesets obsolete on arrival)
# unbundling: (run 'hg update' to get a working copy)
+
+Test that obsolescence markers in bundles are ignored if unsupported
+
+ $ hg init repo-with-obs
+ $ cd repo-with-obs
+ $ hg debugbuilddag +1
+ $ hg debugobsolete `getid 0`
+ 1 new obsolescence markers
+ obsoleted 1 changesets
+ $ hg bundle --config experimental.evolution.bundle-obsmarker=true --all --hidden bundle-with-obs
+ 1 changesets found
+ $ cd ..
+ $ hg init repo-without-obs
+ $ cd repo-without-obs
+ $ hg --config experimental.evolution=False unbundle ../repo-with-obs/bundle-with-obs --debug
+ bundle2-input-bundle: 1 params with-transaction
+ bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
+ adding changesets
+ add changeset 1ea73414a91b
+ adding manifests
+ adding file changes
+ bundle2-input-part: total payload size 190
+ bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
+ bundle2-input-part: total payload size 39
+ bundle2-input-part: "obsmarkers" (advisory) supported
+ bundle2-input-part: total payload size 50
+ ignoring obsolescence markers, feature not enabled
+ bundle2-input-bundle: 3 parts total
+ updating the branch cache
+ added 1 changesets with 0 changes to 0 files
+ new changesets 1ea73414a91b (1 drafts)
+ (run 'hg update' to get a working copy)
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1866,7 +1866,7 @@
if version is None:
raise ValueError(b'bundler does not support common obsmarker format')
stream = obsolete.encodemarkers(markers, True, version=version)
- return bundler.newpart(b'obsmarkers', data=stream)
+ return bundler.newpart(b'obsmarkers', data=stream, mandatory=False)
def writebundle(
To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200424/d3d9cdd4/attachment.html>
More information about the Mercurial-patches
mailing list