##// END OF EJS Templates
tests: factor external procedures out for portability...
FUJIWARA Katsunori -
r32751:627eaab1 default
parent child Browse files
Show More
@@ -1,93 +1,97
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3 $ echo a > a
3 $ echo a > a
4 $ hg add a
4 $ hg add a
5 $ hg commit -m test
5 $ hg commit -m test
6
6
7 Do we ever miss a sub-second change?:
7 Do we ever miss a sub-second change?:
8
8
9 $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
9 $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
10 > hg co -qC 0
10 > hg co -qC 0
11 > echo b > a
11 > echo b > a
12 > hg st
12 > hg st
13 > done
13 > done
14 M a
14 M a
15 M a
15 M a
16 M a
16 M a
17 M a
17 M a
18 M a
18 M a
19 M a
19 M a
20 M a
20 M a
21 M a
21 M a
22 M a
22 M a
23 M a
23 M a
24 M a
24 M a
25 M a
25 M a
26 M a
26 M a
27 M a
27 M a
28 M a
28 M a
29 M a
29 M a
30 M a
30 M a
31 M a
31 M a
32 M a
32 M a
33 M a
33 M a
34
34
35 $ echo test > b
35 $ echo test > b
36 $ mkdir dir1
36 $ mkdir dir1
37 $ echo test > dir1/c
37 $ echo test > dir1/c
38 $ echo test > d
38 $ echo test > d
39
39
40 $ echo test > e
40 $ echo test > e
41 #if execbit
41 #if execbit
42 A directory will typically have the execute bit -- make sure it doesn't get
42 A directory will typically have the execute bit -- make sure it doesn't get
43 confused with a file with the exec bit set
43 confused with a file with the exec bit set
44 $ chmod +x e
44 $ chmod +x e
45 #endif
45 #endif
46
46
47 $ hg add b dir1 d e
47 $ hg add b dir1 d e
48 adding dir1/c (glob)
48 adding dir1/c (glob)
49 $ hg commit -m test2
49 $ hg commit -m test2
50
50
51 $ cat >> $TESTTMP/dirstaterace.py << EOF
51 $ cat >> $TESTTMP/dirstaterace.py << EOF
52 > from mercurial import (
52 > from mercurial import (
53 > context,
53 > context,
54 > extensions,
54 > extensions,
55 > )
55 > )
56 > def extsetup():
56 > def extsetup():
57 > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup)
57 > extensions.wrapfunction(context.workingctx, '_checklookup', overridechecklookup)
58 > def overridechecklookup(orig, self, files):
58 > def overridechecklookup(orig, self, files):
59 > # make an update that changes the dirstate from underneath
59 > # make an update that changes the dirstate from underneath
60 > self._repo.ui.system(self._repo.ui.config('dirstaterace', 'command'), cwd=self._repo.root)
60 > self._repo.ui.system(r"sh '$TESTTMP/dirstaterace.sh'",
61 > cwd=self._repo.root)
61 > return orig(self, files)
62 > return orig(self, files)
62 > EOF
63 > EOF
63
64
64 $ hg debugrebuilddirstate
65 $ hg debugrebuilddirstate
65 $ hg debugdirstate
66 $ hg debugdirstate
66 n 0 -1 unset a
67 n 0 -1 unset a
67 n 0 -1 unset b
68 n 0 -1 unset b
68 n 0 -1 unset d
69 n 0 -1 unset d
69 n 0 -1 unset dir1/c
70 n 0 -1 unset dir1/c
70 n 0 -1 unset e
71 n 0 -1 unset e
71
72
72 XXX Note that this returns M for files that got replaced by directories. This is
73 XXX Note that this returns M for files that got replaced by directories. This is
73 definitely a bug, but the fix for that is hard and the next status run is fine
74 definitely a bug, but the fix for that is hard and the next status run is fine
74 anyway.
75 anyway.
75
76
76 $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py \
77 $ cat > $TESTTMP/dirstaterace.sh <<EOF
77 > --config dirstaterace.command='rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e'
78 > rm b && rm -r dir1 && rm d && mkdir d && rm e && mkdir e
79 > EOF
80
81 $ hg status --config extensions.dirstaterace=$TESTTMP/dirstaterace.py
78 M d
82 M d
79 M e
83 M e
80 ! b
84 ! b
81 ! dir1/c
85 ! dir1/c
82 $ hg debugdirstate
86 $ hg debugdirstate
83 n 644 2 * a (glob)
87 n 644 2 * a (glob)
84 n 0 -1 unset b
88 n 0 -1 unset b
85 n 0 -1 unset d
89 n 0 -1 unset d
86 n 0 -1 unset dir1/c
90 n 0 -1 unset dir1/c
87 n 0 -1 unset e
91 n 0 -1 unset e
88
92
89 $ hg status
93 $ hg status
90 ! b
94 ! b
91 ! d
95 ! d
92 ! dir1/c
96 ! dir1/c
93 ! e
97 ! e
General Comments 0
You need to be logged in to leave comments. Login now