# HG changeset patch # User Jun Wu # Date 1496552183 25200 # Node ID 8b48dad66be4d42aa8194fd3801f5c530ca8bb31 # Parent cf15c3cc304ca41dd8196c05590b345a4ec558aa obsstore: keep self._data updated with _addmarkers This makes sure obsstore._data is still correct with added markers. The '_data' propertycache was added in 17ce57b7873f. diff -r cf15c3cc304c -r 8b48dad66be4 mercurial/obsolete.py --- a/mercurial/obsolete.py Fri Jul 14 10:57:36 2017 -0700 +++ b/mercurial/obsolete.py Sat Jun 03 21:56:23 2017 -0700 @@ -607,8 +607,8 @@ offset = f.tell() transaction.add('obsstore', offset) # offset == 0: new file - add the version header - for bytes in encodemarkers(new, offset == 0, self._version): - f.write(bytes) + data = b''.join(encodemarkers(new, offset == 0, self._version)) + f.write(data) finally: # XXX: f.close() == filecache invalidation == obsstore rebuilt. # call 'filecacheentry.refresh()' here @@ -616,7 +616,7 @@ addedmarkers = transaction.changes.get('obsmarkers') if addedmarkers is not None: addedmarkers.update(new) - self._addmarkers(new) + self._addmarkers(new, data) # new marker *may* have changed several set. invalidate the cache. self.caches.clear() # records the number of new markers for the transaction hooks @@ -673,8 +673,9 @@ def _cached(self, attr): return attr in self.__dict__ - def _addmarkers(self, markers): + def _addmarkers(self, markers, rawdata): markers = list(markers) # to allow repeated iteration + self._data = self._data + rawdata self._all.extend(markers) if self._cached('successors'): _addsuccessors(self.successors, markers)