[PATCH 1 of 2] obsstore: make the readonly attribute accessible

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Oct 15 11:56:00 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1444909534 -3600
#      Thu Oct 15 12:45:34 2015 +0100
# Node ID b882853b5f3a207c283e3bf6a9ad1e40fc7a254b
# Parent  07db7e95c464537aeb2dd7aba39de0813eaffd04
# EXP-Topic obs.advisory
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r b882853b5f3a
obsstore: make the readonly attribute accessible

We want to gravelly handle the read only case in some case (current target:
advisory obsmarkers parts in bundle2). So we expose the attribute in a clean
way.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -540,10 +540,17 @@ class obsstore(object):
                 # just build an empty _all list if no obsstore exists, which
                 # avoids further stat() syscalls
                 pass
         return bool(self._all)
 
+    @property
+    def readonly(self):
+        """True if marker creation is disabled
+
+        Remove me in the future when obsolete marker is always on."""
+        return self._readonly
+
     def create(self, transaction, prec, succs=(), flag=0, parents=None,
                date=None, metadata=None):
         """obsolete: add a new obsolete marker
 
         * ensuring it is hashable


More information about the Mercurial-devel mailing list