Show More
@@ -299,6 +299,20 b' def consumev1(repo, fp, filecount, bytec' | |||||
299 | repo.ui.progress(_('clone'), 0, total=bytecount, unit=_('bytes')) |
|
299 | repo.ui.progress(_('clone'), 0, total=bytecount, unit=_('bytes')) | |
300 | start = time.time() |
|
300 | start = time.time() | |
301 |
|
301 | |||
|
302 | # TODO: get rid of (potential) inconsistency | |||
|
303 | # | |||
|
304 | # If transaction is started and any @filecache property is | |||
|
305 | # changed at this point, it causes inconsistency between | |||
|
306 | # in-memory cached property and streamclone-ed file on the | |||
|
307 | # disk. Nested transaction prevents transaction scope "clone" | |||
|
308 | # below from writing in-memory changes out at the end of it, | |||
|
309 | # even though in-memory changes are discarded at the end of it | |||
|
310 | # regardless of transaction nesting. | |||
|
311 | # | |||
|
312 | # But transaction nesting can't be simply prohibited, because | |||
|
313 | # nesting occurs also in ordinary case (e.g. enabling | |||
|
314 | # clonebundles). | |||
|
315 | ||||
302 | with repo.transaction('clone'): |
|
316 | with repo.transaction('clone'): | |
303 | with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount): |
|
317 | with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount): | |
304 | for i in xrange(filecount): |
|
318 | for i in xrange(filecount): | |
@@ -322,7 +336,8 b' def consumev1(repo, fp, filecount, bytec' | |||||
322 | total=bytecount, unit=_('bytes')) |
|
336 | total=bytecount, unit=_('bytes')) | |
323 | ofp.write(chunk) |
|
337 | ofp.write(chunk) | |
324 |
|
338 | |||
325 | # Writing straight to files circumvented the inmemory caches |
|
339 | # force @filecache properties to be reloaded from | |
|
340 | # streamclone-ed file at next access | |||
326 | repo.invalidate(clearfilecache=True) |
|
341 | repo.invalidate(clearfilecache=True) | |
327 |
|
342 | |||
328 | elapsed = time.time() - start |
|
343 | elapsed = time.time() - start |
@@ -310,9 +310,51 b' Unpacking packed1 bundles with "hg unbun' | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now