author | Pierre-Yves David <pierre-yves.david@fb.com> |
Mon, 24 Mar 2014 17:20:15 -0700 | |
changeset 20892 | 6fe95448596d |
parent 20653 | 3bfac190c7cd |
child 20969 | 7a679918ee2b |
permissions | -rw-r--r-- |
20380
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
1 |
#if unix-permissions no-root no-windows |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
2 |
|
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
3 |
Prepare |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
4 |
|
12071
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
5 |
$ hg init a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
6 |
$ echo a > a/a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
7 |
$ hg -R a ci -A -m a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
8 |
adding a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
9 |
|
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
10 |
$ hg clone a b |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
11 |
updating to branch default |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
12 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 |
|
20380
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
14 |
One process waiting for another |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
15 |
|
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
16 |
$ cat > hooks.py << EOF |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
17 |
> import time |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
18 |
> def sleepone(**x): time.sleep(1) |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
19 |
> def sleephalf(**x): time.sleep(0.5) |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
20 |
> EOF |
12071
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
21 |
$ echo b > b/b |
20380
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
22 |
$ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout & |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
23 |
$ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
24 |
waiting for lock on working directory of b held by '*:*' (glob) |
20653
3bfac190c7cd
tests: match time by a glob to fix intermittent failures of test-lock-badness.t
Simon Heimberg <simohe@besonet.ch>
parents:
20380
diff
changeset
|
25 |
got lock after ? seconds (glob) |
20380
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
26 |
warning: ignoring unknown working parent d2ae7f538514! |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
27 |
$ wait |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
28 |
$ cat stdout |
12071
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
29 |
adding b |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
30 |
|
20380
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
31 |
Pushing to a local read-only repo that can't be locked |
c697b70f295f
localrepo: give a sigh of relief when getting lock after waiting for it
Mads Kiilerich <madski@unity3d.com>
parents:
20008
diff
changeset
|
32 |
|
12071
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
33 |
$ chmod 100 a/.hg/store |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
34 |
|
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
35 |
$ hg -R b push a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
36 |
pushing to a |
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
37 |
abort: could not lock repository a: Permission denied |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12071
diff
changeset
|
38 |
[255] |
12071
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
39 |
|
45ff6dcf82ea
tests: unify test-lock-badness
Adrian Buehlmann <adrian@cadifra.com>
parents:
3853
diff
changeset
|
40 |
$ chmod 700 a/.hg/store |
20008
e54a078153f7
tests: skip tests that require not having root (issue4089)
Matt Mackall <mpm@selenic.com>
parents:
15443
diff
changeset
|
41 |
#endif |