Mercurial > hg-stable
diff tests/lockdelay.py @ 30068:a76d5ba7ac43
pull: grab wlock during pull
because pull might move bookmarks and bookmark are protected by wlock, we have
to grab wlock for pull :-(
This required a small upgrade of the 'lockdelay' extension used by
'test-clone.t' because the delay must apply to a single lock only.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 23 Aug 2016 23:47:59 +0200 |
parents | d493d64757eb |
children | 2372284d9457 |
line wrap: on
line diff
--- a/tests/lockdelay.py Wed Aug 24 04:19:11 2016 +0200 +++ b/tests/lockdelay.py Tue Aug 23 23:47:59 2016 +0200 @@ -7,20 +7,16 @@ import os import time -from mercurial import ( - lock as lockmod, -) +def reposetup(ui, repo): -class delaylock(lockmod.lock): - def lock(self): - delay = float(os.environ.get('HGPRELOCKDELAY', '0.0')) - if delay: - time.sleep(delay) - res = super(delaylock, self).lock() - delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0')) - if delay: - time.sleep(delay) - return res - -def extsetup(ui): - lockmod.lock = delaylock + class delayedlockrepo(repo.__class__): + def lock(self): + delay = float(os.environ.get('HGPRELOCKDELAY', '0.0')) + if delay: + time.sleep(delay) + res = super(delayedlockrepo, self).lock() + delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0')) + if delay: + time.sleep(delay) + return res + repo.__class__ = delayedlockrepo