Patchwork [18,of,22] obsstore: make _all always calculate from _data

login
register
mail settings
Submitter Jun Wu
Date June 4, 2017, 11:59 p.m.
Message ID <2c2cbefde423ea253727.1496620770@x1c>
Download mbox | patch
Permalink /patch/21198/
State Accepted
Headers show

Comments

Jun Wu - June 4, 2017, 11:59 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1496604924 25200
#      Sun Jun 04 12:35:24 2017 -0700
# Node ID 2c2cbefde423ea2537270cf5fecdf5f5d14b19e5
# Parent  df25a444c9f9f1b0860d782d6adceadd5cc810fd
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 2c2cbefde423
obsstore: make _all always calculate from _data

Now we have more advanced caching on a lower level, let's make "_all"
read-only and always calculated from its source of truth ("_data").

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -775,5 +775,5 @@  class obsstore(object):
             return self._defaultformat
 
-    @propertycache
+    @property
     def _all(self):
         markers, _offsets = self._readmarkers()
@@ -798,5 +798,4 @@  class obsstore(object):
         markers = list(markers) # to allow repeated iteration
         self._data = self._data + rawdata
-        self._all.extend(markers)
         for name in ('successors', 'precursors', 'children'):
             index = self.__dict__.get(name, None)