--- 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