obsstore: delay loading markers from obsstore file
This will allow us to use cached revisions without parsing obsstore.
Because _version isn't determined at __init__, the debugobsconvert command no
longer works correctly. I'll fix it by a separate patch for the evolve
extension.
--- a/mercurial/obsolete.py Sun Sep 13 17:47:18 2015 +0900
+++ b/mercurial/obsolete.py Sun Sep 13 17:52:37 2015 +0900
@@ -520,16 +520,9 @@
def __init__(self, svfs, defaultformat=_fm1version, readonly=False):
# caches for various obsolescence related cache
self.caches = {}
- self._all = []
self.svfs = svfs
- data = svfs.tryread('obsstore')
self._version = defaultformat
self._readonly = readonly
- if data:
- self._version, markers = _readmarkers(data)
- markers = list(markers)
- _checkinvalidmarkers(markers)
- self._all = markers
def __iter__(self):
return iter(self._all)
@@ -617,6 +610,16 @@
return self.add(transaction, markers)
@propertycache
+ def _all(self):
+ data = self.svfs.tryread('obsstore')
+ if not data:
+ return []
+ self._version, markers = _readmarkers(data)
+ markers = list(markers)
+ _checkinvalidmarkers(markers)
+ return markers
+
+ @propertycache
def successors(self):
successors = {}
_addsuccessors(successors, self._all)