Show More
@@ -1,23 +1,23 b'' | |||
|
1 | 1 | # Dummy extension that adds a delay after acquiring a lock. |
|
2 | 2 | # |
|
3 | 3 | # This extension can be used to test race conditions between lock acquisition. |
|
4 | 4 | |
|
5 | 5 | from __future__ import absolute_import |
|
6 | 6 | |
|
7 | 7 | import os |
|
8 | 8 | import time |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | def reposetup(ui, repo): |
|
12 | 12 | class delayedlockrepo(repo.__class__): |
|
13 | def lock(self): | |
|
13 | def lock(self, wait=True): | |
|
14 | 14 | delay = float(os.environ.get('HGPRELOCKDELAY', '0.0')) |
|
15 | 15 | if delay: |
|
16 | 16 | time.sleep(delay) |
|
17 | res = super(delayedlockrepo, self).lock() | |
|
17 | res = super(delayedlockrepo, self).lock(wait=wait) | |
|
18 | 18 | delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0')) |
|
19 | 19 | if delay: |
|
20 | 20 | time.sleep(delay) |
|
21 | 21 | return res |
|
22 | 22 | |
|
23 | 23 | repo.__class__ = delayedlockrepo |
General Comments 0
You need to be logged in to leave comments.
Login now