Mercurial > hg
comparison tests/test-bundle.t @ 29919:519a02267f90
streamclone: clear caches after writing changes into files for visibility
Before this patch, streamclone-ed changes are invisible via @filecache
properties to in-process procedures before closing transaction
(e.g. pretxnclose python hook), if corresponded property is cached
before consumev1(). Strictly speaking, caching should occur inside
(store) lock for transaction.
repo.invalidate() after closing transaction is too late to force
@filecache properties to be reloaded from changed files at next
access.
For visibility of streamclone-ed changes to in-process procedures
before closing transaction, this patch clears caches just after
writing changes into files.
BTW, regardless of changing in this patch, clearing cached properties
in consumev1() causes inconsistency, if (1) transaction is started and
(2) any @filecache property is changed before consumev1().
This patch also adds the comment to fix this (potential) inconsistency
in the future.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 12 Sep 2016 03:06:29 +0900 |
parents | 953839de96ab |
children | 1659549870e1 |
comparison
equal
deleted
inserted
replaced
29918:d9c49138ab93 | 29919:519a02267f90 |
---|---|
308 (use "hg debugapplystreamclonebundle") | 308 (use "hg debugapplystreamclonebundle") |
309 [255] | 309 [255] |
310 | 310 |
311 packed1 can be consumed from debug command | 311 packed1 can be consumed from debug command |
312 | 312 |
313 (this also confirms that streamclone-ed changes are visible via | |
314 @filecache properties to in-process procedures before closing | |
315 transaction) | |
316 | |
317 $ cat > $TESTTMP/showtip.py <<EOF | |
318 > from __future__ import absolute_import | |
319 > | |
320 > def showtip(ui, repo, hooktype, **kwargs): | |
321 > ui.warn('%s: %s\n' % (hooktype, repo['tip'].hex()[:12])) | |
322 > | |
323 > def reposetup(ui, repo): | |
324 > # this confirms (and ensures) that (empty) 00changelog.i | |
325 > # before streamclone is already cached as repo.changelog | |
326 > ui.setconfig('hooks', 'pretxnopen.showtip', showtip) | |
327 > | |
328 > # this confirms that streamclone-ed changes are visible to | |
329 > # in-process procedures before closing transaction | |
330 > ui.setconfig('hooks', 'pretxnclose.showtip', showtip) | |
331 > | |
332 > # this confirms that streamclone-ed changes are still visible | |
333 > # after closing transaction | |
334 > ui.setconfig('hooks', 'txnclose.showtip', showtip) | |
335 > EOF | |
336 $ cat >> $HGRCPATH <<EOF | |
337 > [extensions] | |
338 > showtip = $TESTTMP/showtip.py | |
339 > EOF | |
340 | |
313 $ hg -R packed debugapplystreamclonebundle packed.hg | 341 $ hg -R packed debugapplystreamclonebundle packed.hg |
314 6 files to transfer, 2.60 KB of data | 342 6 files to transfer, 2.60 KB of data |
343 pretxnopen: 000000000000 | |
344 pretxnclose: aa35859c02ea | |
315 transferred 2.60 KB in *.* seconds (* */sec) (glob) | 345 transferred 2.60 KB in *.* seconds (* */sec) (glob) |
346 txnclose: aa35859c02ea | |
347 | |
348 (for safety, confirm visibility of streamclone-ed changes by another | |
349 process, too) | |
350 | |
351 $ hg -R packed tip -T "{node|short}\n" | |
352 aa35859c02ea | |
353 | |
354 $ cat >> $HGRCPATH <<EOF | |
355 > [extensions] | |
356 > showtip = ! | |
357 > EOF | |
316 | 358 |
317 Does not work on non-empty repo | 359 Does not work on non-empty repo |
318 | 360 |
319 $ hg -R packed debugapplystreamclonebundle packed.hg | 361 $ hg -R packed debugapplystreamclonebundle packed.hg |
320 abort: cannot apply stream clone bundle on non-empty repo | 362 abort: cannot apply stream clone bundle on non-empty repo |