Mercurial > hg
changeset 33479:8b48dad66be4
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.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 03 Jun 2017 21:56:23 -0700 |
parents | cf15c3cc304c |
children | ef54789a947d |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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)