mercurial/bundle2.py
changeset 46165 41d695a08e90
parent 46114 59fa3890d40a
child 46166 c511fef30290
--- 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(