diff mercurial/bundle2.py @ 46165:41d695a08e90

bundle: optional advisory obsolescence parts It is useful to ship obsolescence markers as part of clonebundles or pullbundles, but they shouldn't stop a non-evolution client from working. Differential Revision: https://phab.mercurial-scm.org/D8480
author Joerg Sonnenberger <joerg@bec.de>
date Fri, 24 Apr 2020 16:36:04 +0200
parents 59fa3890d40a
children c511fef30290
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Dec 17 09:35:07 2020 -0800
+++ b/mercurial/bundle2.py	Fri Apr 24 16:36:04 2020 +0200
@@ -1739,7 +1739,11 @@
 
     if opts.get(b'obsolescence', False):
         obsmarkers = repo.obsstore.relevantmarkers(outgoing.missing)
-        buildobsmarkerspart(bundler, obsmarkers)
+        buildobsmarkerspart(
+            bundler,
+            obsmarkers,
+            mandatory=opts.get(b'obsolescence-mandatory', True),
+        )
 
     if opts.get(b'phases', False):
         headsbyphase = phases.subsetphaseheads(repo, outgoing.missing)
@@ -1862,7 +1866,7 @@
     part.addparam(b'requirements', requirements, mandatory=True)
 
 
-def buildobsmarkerspart(bundler, markers):
+def buildobsmarkerspart(bundler, markers, mandatory=True):
     """add an obsmarker part to the bundler with <markers>
 
     No part is created if markers is empty.
@@ -1876,7 +1880,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=mandatory)
 
 
 def writebundle(