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

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 15, 2015, 11:56 a.m.
Message ID <b882853b5f3a207c283e.1444910160@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11101/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 15, 2015, 11:56 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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