bundle2: gracefully skip 'obsmarkers' part if evolution is disabled
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 15 Oct 2015 03:29:00 +0100
changeset 26685 ea390d889d3a
parent 26684 74ff350c208c
child 26686 3e7f675628ad
bundle2: gracefully skip 'obsmarkers' part if evolution is disabled We would skip the part if it was fully unknown, so we should also skip it if we know we won't be able to apply it. This will allow us to produce bundles with obsolescence markers alongside changegroup while still being able to apply them on any client.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Thu Oct 15 12:45:34 2015 +0100
+++ b/mercurial/bundle2.py	Thu Oct 15 03:29:00 2015 +0100
@@ -1481,6 +1481,11 @@
     if op.ui.config('experimental', 'obsmarkers-exchange-debug', False):
         op.ui.write(('obsmarker-exchange: %i bytes received\n')
                     % len(markerdata))
+    # The mergemarkers call will crash if marker creation is not enabled.
+    # we want to avoid this if the part is advisory.
+    if not inpart.mandatory and op.repo.obsstore.readonly:
+        op.repo.ui.debug('ignoring obsolescence markers, feature not enabled')
+        return
     new = op.repo.obsstore.mergemarkers(tr, markerdata)
     if new:
         op.repo.ui.status(_('%i new obsolescence markers\n') % new)