8 adding a |
8 adding a |
9 |
9 |
10 $ hg clone a b |
10 $ hg clone a b |
11 updating to branch default |
11 updating to branch default |
12 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 |
|
13 |
|
14 Test that raising an exception in the release function doesn't cause the lock to choke |
|
15 |
|
16 $ cat > testlock.py << EOF |
|
17 > from mercurial import cmdutil, error, util |
|
18 > |
|
19 > cmdtable = {} |
|
20 > command = cmdutil.command(cmdtable) |
|
21 > |
|
22 > def acquiretestlock(repo, releaseexc): |
|
23 > def unlock(): |
|
24 > if releaseexc: |
|
25 > raise util.Abort('expected release exception') |
|
26 > l = repo._lock(repo.vfs, 'testlock', False, unlock, None, 'test lock') |
|
27 > return l |
|
28 > |
|
29 > @command('testlockexc') |
|
30 > def testlockexc(ui, repo): |
|
31 > testlock = acquiretestlock(repo, True) |
|
32 > try: |
|
33 > testlock.release() |
|
34 > finally: |
|
35 > try: |
|
36 > testlock = acquiretestlock(repo, False) |
|
37 > except error.LockHeld: |
|
38 > raise util.Abort('lockfile on disk even after releasing!') |
|
39 > testlock.release() |
|
40 > EOF |
|
41 $ cat >> $HGRCPATH << EOF |
|
42 > [extensions] |
|
43 > testlock=$TESTTMP/testlock.py |
|
44 > EOF |
|
45 |
|
46 $ hg -R b testlockexc |
|
47 abort: expected release exception |
|
48 [255] |
13 |
49 |
14 One process waiting for another |
50 One process waiting for another |
15 |
51 |
16 $ cat > hooks.py << EOF |
52 $ cat > hooks.py << EOF |
17 > import time |
53 > import time |