comparison tests/test-fncache.t @ 40262:c8f164061212

tests: fix inline extension in test-fncache.t for Python 3 # skip-blame just some b prefixing Differential Revision: https://phab.mercurial-scm.org/D5083
author Augie Fackler <augie@google.com>
date Sat, 13 Oct 2018 09:03:08 -0400
parents f44187605315
children bd0874977a5e
comparison
equal deleted inserted replaced
40261:4b5d9eb1428f 40262:c8f164061212
303 > ) 303 > )
304 > 304 >
305 > def trwrapper(orig, self, *args, **kwargs): 305 > def trwrapper(orig, self, *args, **kwargs):
306 > tr = orig(self, *args, **kwargs) 306 > tr = orig(self, *args, **kwargs)
307 > def fail(tr): 307 > def fail(tr):
308 > raise error.Abort("forced transaction failure") 308 > raise error.Abort(b"forced transaction failure")
309 > # zzz prefix to ensure it sorted after store.write 309 > # zzz prefix to ensure it sorted after store.write
310 > tr.addfinalize('zzz-forcefails', fail) 310 > tr.addfinalize(b'zzz-forcefails', fail)
311 > return tr 311 > return tr
312 > 312 >
313 > def abortwrapper(orig, self, *args, **kwargs): 313 > def abortwrapper(orig, self, *args, **kwargs):
314 > raise error.Abort("forced transaction failure") 314 > raise error.Abort(b"forced transaction failure")
315 > 315 >
316 > def uisetup(ui): 316 > def uisetup(ui):
317 > extensions.wrapfunction(localrepo.localrepository, 'transaction', 317 > extensions.wrapfunction(localrepo.localrepository, 'transaction',
318 > trwrapper) 318 > trwrapper)
319 > extensions.wrapfunction(transaction.transaction, '_abort', 319 > extensions.wrapfunction(transaction.transaction, '_abort',
451 > from mercurial import extensions, localrepo 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 b'store' in requirements and b'fncache' in requirements:
457 > instrumentfncachestore(store, ui) 457 > instrumentfncachestore(store, ui)
458 > return store 458 > return store
459 > extensions.wrapfunction(localrepo, 'makestore', 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(b'fncache load triggered!\n')
465 > super(instrumentedfncache, self)._load() 465 > super(instrumentedfncache, self)._load()
466 > fncachestore.fncache.__class__ = instrumentedfncache 466 > fncachestore.fncache.__class__ = instrumentedfncache
467 > EOF 467 > EOF
468 468
469 $ fncachextpath=`pwd`/fncacheloadwarn.py 469 $ fncachextpath=`pwd`/fncacheloadwarn.py