[PATCH 03 of 14] obsstore: keep self._data updated with _addmarkers
Augie Fackler
raf at durin42.com
Fri Jul 14 14:05:53 EDT 2017
On Sun, Jul 09, 2017 at 07:55:15PM +0200, Boris Feld wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1496552183 25200
> # Sat Jun 03 21:56:23 2017 -0700
> # Node ID ff2ebc11f12a26a4e0bda3ccf5fde63f5f690813
> # Parent 8b71290526ddb77f157e075191dd748793d85601
> # EXP-Topic obs-cache
> obsstore: keep self._data updated with _addmarkers
Took this one.
>
> This makes sure obsstore._data is still correct with added markers.
>
> The '_data' propertycache was added in 17ce57b7873f.
>
> diff -r 8b71290526dd -r ff2ebc11f12a mercurial/obsolete.py
> --- a/mercurial/obsolete.py Fri Jul 07 22:15:52 2017 +0200
> +++ 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)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list