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

Yuya Nishihara yuya at tcha.org
Wed Sep 23 05:48:02 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at 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.

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)


More information about the Mercurial-devel mailing list