Show More
@@ -1005,6 +1005,7 b' class localrepository(object):' | |||||
1005 | l = lockmod.lock(vfs, lockname, |
|
1005 | l = lockmod.lock(vfs, lockname, | |
1006 | int(self.ui.config("ui", "timeout", "600")), |
|
1006 | int(self.ui.config("ui", "timeout", "600")), | |
1007 | releasefn, desc=desc) |
|
1007 | releasefn, desc=desc) | |
|
1008 | self.ui.warn(_("got lock after %s seconds\n") % l.delay) | |||
1008 | if acquirefn: |
|
1009 | if acquirefn: | |
1009 | acquirefn() |
|
1010 | acquirefn() | |
1010 | return l |
|
1011 | return l |
@@ -38,7 +38,7 b' class lock(object):' | |||||
38 | self.desc = desc |
|
38 | self.desc = desc | |
39 | self.postrelease = [] |
|
39 | self.postrelease = [] | |
40 | self.pid = os.getpid() |
|
40 | self.pid = os.getpid() | |
41 | self.lock() |
|
41 | self.delay = self.lock() | |
42 |
|
42 | |||
43 | def __del__(self): |
|
43 | def __del__(self): | |
44 | if self.held: |
|
44 | if self.held: | |
@@ -57,7 +57,7 b' class lock(object):' | |||||
57 | while True: |
|
57 | while True: | |
58 | try: |
|
58 | try: | |
59 | self.trylock() |
|
59 | self.trylock() | |
60 |
return |
|
60 | return self.timeout - timeout | |
61 | except error.LockHeld, inst: |
|
61 | except error.LockHeld, inst: | |
62 | if timeout != 0: |
|
62 | if timeout != 0: | |
63 | time.sleep(1) |
|
63 | time.sleep(1) |
@@ -1,4 +1,7 b'' | |||||
1 | #if unix-permissions no-root |
|
1 | #if unix-permissions no-root no-windows | |
|
2 | ||||
|
3 | Prepare | |||
|
4 | ||||
2 | $ hg init a |
|
5 | $ hg init a | |
3 | $ echo a > a/a |
|
6 | $ echo a > a/a | |
4 | $ hg -R a ci -A -m a |
|
7 | $ hg -R a ci -A -m a | |
@@ -8,10 +11,25 b'' | |||||
8 | updating to branch default |
|
11 | updating to branch default | |
9 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
12 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
10 |
|
13 | |||
|
14 | One process waiting for another | |||
|
15 | ||||
|
16 | $ cat > hooks.py << EOF | |||
|
17 | > import time | |||
|
18 | > def sleepone(**x): time.sleep(1) | |||
|
19 | > def sleephalf(**x): time.sleep(0.5) | |||
|
20 | > EOF | |||
11 | $ echo b > b/b |
|
21 | $ echo b > b/b | |
12 | $ hg -R b ci -A -m b |
|
22 | $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout & | |
|
23 | $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" | |||
|
24 | waiting for lock on working directory of b held by '*:*' (glob) | |||
|
25 | got lock after 1 seconds | |||
|
26 | warning: ignoring unknown working parent d2ae7f538514! | |||
|
27 | $ wait | |||
|
28 | $ cat stdout | |||
13 | adding b |
|
29 | adding b | |
14 |
|
30 | |||
|
31 | Pushing to a local read-only repo that can't be locked | |||
|
32 | ||||
15 | $ chmod 100 a/.hg/store |
|
33 | $ chmod 100 a/.hg/store | |
16 |
|
34 | |||
17 | $ hg -R b push a |
|
35 | $ hg -R b push a |
General Comments 0
You need to be logged in to leave comments.
Login now