Mercurial > hg
comparison tests/test-fncache.t @ 39698:f44187605315
localrepo: move store() from store module
I want logic related to requirements handling to be in the localrepo
module so it is all in one place.
I would have loved to inline this logic. Unfortunately, statichttprepo
also calls it. I didn't want to inline it twice. We could potentially
refactor statichttppeer. But meh.
Differential Revision: https://phab.mercurial-scm.org/D4574
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 12 Sep 2018 15:07:27 -0700 |
parents | f1186c292d03 |
children | c8f164061212 |
comparison
equal
deleted
inserted
replaced
39697:98ca9078807a | 39698:f44187605315 |
---|---|
446 The cache should not loaded when committing changes to existing files, or when unbundling | 446 The cache should not loaded when committing changes to existing files, or when unbundling |
447 changesets that only contain changes to existing files: | 447 changesets that only contain changes to existing files: |
448 | 448 |
449 $ cat > fncacheloadwarn.py << EOF | 449 $ cat > fncacheloadwarn.py << EOF |
450 > from __future__ import absolute_import | 450 > from __future__ import absolute_import |
451 > from mercurial import extensions, store | 451 > from mercurial import extensions, localrepo |
452 > | 452 > |
453 > def extsetup(ui): | 453 > def extsetup(ui): |
454 > def wrapstore(orig, requirements, *args): | 454 > def wrapstore(orig, requirements, *args): |
455 > store = orig(requirements, *args) | 455 > store = orig(requirements, *args) |
456 > if 'store' in requirements and 'fncache' in requirements: | 456 > if 'store' in requirements and 'fncache' in requirements: |
457 > instrumentfncachestore(store, ui) | 457 > instrumentfncachestore(store, ui) |
458 > return store | 458 > return store |
459 > extensions.wrapfunction(store, 'store', wrapstore) | 459 > extensions.wrapfunction(localrepo, 'makestore', wrapstore) |
460 > | 460 > |
461 > def instrumentfncachestore(fncachestore, ui): | 461 > def instrumentfncachestore(fncachestore, ui): |
462 > class instrumentedfncache(type(fncachestore.fncache)): | 462 > class instrumentedfncache(type(fncachestore.fncache)): |
463 > def _load(self): | 463 > def _load(self): |
464 > ui.warn('fncache load triggered!\n') | 464 > ui.warn('fncache load triggered!\n') |