Patchwork [1,of,5,RFC] obsstore: initialize _all markers without using _addmarkers()

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 23, 2015, 5:48 a.m.
Message ID <85f2c8734f280440aea2.1442987282@mimosa>
Download mbox | patch
Permalink /patch/10588/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 23, 2015, 5:48 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1442134038 -32400
#      Sun Sep 13 17:47:18 2015 +0900
# Node ID 85f2c8734f280440aea2f51b530c5af6964b9215
# Parent  f946c1260035f96aa30052c28e6c68c559677059
obsstore: initialize _all markers without using _addmarkers()

The next patch will make _all variable propertycached to avoid costly parsing
of obsstore. This means we can't call _addmarkers() to initialize _all.

Because all cached markers depend on _all, it isn't necessary to update these
caches when _all is initially loaded.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -527,7 +527,9 @@  class obsstore(object):
         self._readonly = readonly
         if data:
             self._version, markers = _readmarkers(data)
-            self._addmarkers(markers)
+            markers = list(markers)
+            _checkinvalidmarkers(markers)
+            self._all = markers
 
     def __iter__(self):
         return iter(self._all)