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