##// END OF EJS Templates
tests: use `test -f` instead of `ls` to see if a file is present (issue6662)...
av6 -
r50668:13c0e3b4 stable
parent child Browse files
Show More
@@ -1,243 +1,240
1 ===============================
1 ===============================
2 Test the "tracked hint" feature
2 Test the "tracked hint" feature
3 ===============================
3 ===============================
4
4
5 The tracked hint feature provide a file that get updated when the set of tracked
5 The tracked hint feature provide a file that get updated when the set of tracked
6 files get updated.
6 files get updated.
7
7
8 basic setup
8 basic setup
9
9
10 $ cat << EOF >> $HGRCPATH
10 $ cat << EOF >> $HGRCPATH
11 > [format]
11 > [format]
12 > use-dirstate-tracked-hint=yes
12 > use-dirstate-tracked-hint=yes
13 > EOF
13 > EOF
14
14
15 $ hg init tracked-hint-test
15 $ hg init tracked-hint-test
16 $ cd tracked-hint-test
16 $ cd tracked-hint-test
17 $ hg debugbuilddag '.+10' -n
17 $ hg debugbuilddag '.+10' -n
18 $ hg log -G -T '{rev} {desc} {files}\n'
18 $ hg log -G -T '{rev} {desc} {files}\n'
19 o 10 r10 nf10
19 o 10 r10 nf10
20 |
20 |
21 o 9 r9 nf9
21 o 9 r9 nf9
22 |
22 |
23 o 8 r8 nf8
23 o 8 r8 nf8
24 |
24 |
25 o 7 r7 nf7
25 o 7 r7 nf7
26 |
26 |
27 o 6 r6 nf6
27 o 6 r6 nf6
28 |
28 |
29 o 5 r5 nf5
29 o 5 r5 nf5
30 |
30 |
31 o 4 r4 nf4
31 o 4 r4 nf4
32 |
32 |
33 o 3 r3 nf3
33 o 3 r3 nf3
34 |
34 |
35 o 2 r2 nf2
35 o 2 r2 nf2
36 |
36 |
37 o 1 r1 nf1
37 o 1 r1 nf1
38 |
38 |
39 o 0 r0 nf0
39 o 0 r0 nf0
40
40
41 $ hg up tip
41 $ hg up tip
42 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 11 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ hg files
43 $ hg files
44 nf0
44 nf0
45 nf1
45 nf1
46 nf10
46 nf10
47 nf2
47 nf2
48 nf3
48 nf3
49 nf4
49 nf4
50 nf5
50 nf5
51 nf6
51 nf6
52 nf7
52 nf7
53 nf8
53 nf8
54 nf9
54 nf9
55
55
56 key-file exists
56 key-file exists
57 -----------
57 -----------
58
58
59 The tracked hint file should exist
59 The tracked hint file should exist
60
60
61 $ ls -1 .hg/dirstate*
61 $ ls -1 .hg/dirstate*
62 .hg/dirstate
62 .hg/dirstate
63 .hg/dirstate-tracked-hint
63 .hg/dirstate-tracked-hint
64
64
65 key-file stay the same if the tracked set is unchanged
65 key-file stay the same if the tracked set is unchanged
66 ------------------------------------------------------
66 ------------------------------------------------------
67
67
68 (copy its content for later comparison)
68 (copy its content for later comparison)
69
69
70 $ cp .hg/dirstate-tracked-hint ../key-bck
70 $ cp .hg/dirstate-tracked-hint ../key-bck
71 $ echo foo >> nf0
71 $ echo foo >> nf0
72 $ sleep 1
72 $ sleep 1
73 $ hg status
73 $ hg status
74 M nf0
74 M nf0
75 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
75 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
76 $ hg revert -C nf0
76 $ hg revert -C nf0
77 $ sleep 1
77 $ sleep 1
78 $ hg status
78 $ hg status
79 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
79 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
80
80
81 key-file change if the tracked set is changed manually
81 key-file change if the tracked set is changed manually
82 ------------------------------------------------------
82 ------------------------------------------------------
83
83
84 adding a file to tracking
84 adding a file to tracking
85
85
86 $ cp .hg/dirstate-tracked-hint ../key-bck
86 $ cp .hg/dirstate-tracked-hint ../key-bck
87 $ echo x > x
87 $ echo x > x
88 $ hg add x
88 $ hg add x
89 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
89 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
90 Files .hg/dirstate-tracked-hint and ../key-bck differ
90 Files .hg/dirstate-tracked-hint and ../key-bck differ
91 [1]
91 [1]
92
92
93 remove a file from tracking
93 remove a file from tracking
94 (forget)
94 (forget)
95
95
96 $ cp .hg/dirstate-tracked-hint ../key-bck
96 $ cp .hg/dirstate-tracked-hint ../key-bck
97 $ hg forget x
97 $ hg forget x
98 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
98 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
99 Files .hg/dirstate-tracked-hint and ../key-bck differ
99 Files .hg/dirstate-tracked-hint and ../key-bck differ
100 [1]
100 [1]
101
101
102 (remove)
102 (remove)
103
103
104 $ cp .hg/dirstate-tracked-hint ../key-bck
104 $ cp .hg/dirstate-tracked-hint ../key-bck
105 $ hg remove nf1
105 $ hg remove nf1
106 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
106 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
107 Files .hg/dirstate-tracked-hint and ../key-bck differ
107 Files .hg/dirstate-tracked-hint and ../key-bck differ
108 [1]
108 [1]
109
109
110 key-file changes on revert (when applicable)
110 key-file changes on revert (when applicable)
111 --------------------------------------------
111 --------------------------------------------
112
112
113 $ cp .hg/dirstate-tracked-hint ../key-bck
113 $ cp .hg/dirstate-tracked-hint ../key-bck
114 $ hg status
114 $ hg status
115 R nf1
115 R nf1
116 ? x
116 ? x
117 $ hg revert --all
117 $ hg revert --all
118 undeleting nf1
118 undeleting nf1
119 $ hg status
119 $ hg status
120 ? x
120 ? x
121 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
121 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
122 Files .hg/dirstate-tracked-hint and ../key-bck differ
122 Files .hg/dirstate-tracked-hint and ../key-bck differ
123 [1]
123 [1]
124
124
125
125
126 `hg update` does affect the key-file (when needed)
126 `hg update` does affect the key-file (when needed)
127 --------------------------------------------------
127 --------------------------------------------------
128
128
129 update changing the tracked set
129 update changing the tracked set
130
130
131 (removing)
131 (removing)
132
132
133 $ cp .hg/dirstate-tracked-hint ../key-bck
133 $ cp .hg/dirstate-tracked-hint ../key-bck
134 $ hg status --rev . --rev '.#generations[-1]'
134 $ hg status --rev . --rev '.#generations[-1]'
135 R nf10
135 R nf10
136 $ hg up '.#generations[-1]'
136 $ hg up '.#generations[-1]'
137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
137 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
138 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
138 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
139 Files .hg/dirstate-tracked-hint and ../key-bck differ
139 Files .hg/dirstate-tracked-hint and ../key-bck differ
140 [1]
140 [1]
141
141
142 (adding)
142 (adding)
143
143
144 $ cp .hg/dirstate-tracked-hint ../key-bck
144 $ cp .hg/dirstate-tracked-hint ../key-bck
145 $ hg status --rev . --rev '.#generations[1]'
145 $ hg status --rev . --rev '.#generations[1]'
146 A nf10
146 A nf10
147 $ hg up '.#generations[1]'
147 $ hg up '.#generations[1]'
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
148 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
149 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
150 Files .hg/dirstate-tracked-hint and ../key-bck differ
150 Files .hg/dirstate-tracked-hint and ../key-bck differ
151 [1]
151 [1]
152
152
153 update not affecting the tracked set
153 update not affecting the tracked set
154
154
155 $ echo foo >> nf0
155 $ echo foo >> nf0
156 $ hg commit -m foo
156 $ hg commit -m foo
157
157
158 $ cp .hg/dirstate-tracked-hint ../key-bck
158 $ cp .hg/dirstate-tracked-hint ../key-bck
159 $ hg status --rev . --rev '.#generations[-1]'
159 $ hg status --rev . --rev '.#generations[-1]'
160 M nf0
160 M nf0
161 $ hg up '.#generations[-1]'
161 $ hg up '.#generations[-1]'
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
163 $ diff --brief .hg/dirstate-tracked-hint ../key-bck
164
164
165 Test upgrade and downgrade
165 Test upgrade and downgrade
166 ==========================
166 ==========================
167
167
168 $ ls .hg/dirstate-tracked-hint
168 $ test -f .hg/dirstate-tracked-hint
169 .hg/dirstate-tracked-hint
170 $ hg debugrequires | grep 'tracked'
169 $ hg debugrequires | grep 'tracked'
171 dirstate-tracked-key-v1
170 dirstate-tracked-key-v1
172
171
173 downgrade
172 downgrade
174
173
175 $ hg debugupgraderepo --config format.use-dirstate-tracked-hint=no --run --quiet
174 $ hg debugupgraderepo --config format.use-dirstate-tracked-hint=no --run --quiet
176 upgrade will perform the following actions:
175 upgrade will perform the following actions:
177
176
178 requirements
177 requirements
179 preserved: * (glob)
178 preserved: * (glob)
180 removed: dirstate-tracked-key-v1
179 removed: dirstate-tracked-key-v1
181
180
182 no revlogs to process
181 no revlogs to process
183
182
184 $ ls -1 .hg/dirstate-tracked-hint
183 $ test -f .hg/dirstate-tracked-hint
185 ls: *.hg/dirstate-tracked-hint*: $ENOENT$ (glob)
184 [1]
186 [2]
187 $ hg debugrequires | grep 'tracked'
185 $ hg debugrequires | grep 'tracked'
188 [1]
186 [1]
189
187
190 upgrade
188 upgrade
191
189
192 $ hg debugupgraderepo --config format.use-dirstate-tracked-hint=yes --run --quiet
190 $ hg debugupgraderepo --config format.use-dirstate-tracked-hint=yes --run --quiet
193 upgrade will perform the following actions:
191 upgrade will perform the following actions:
194
192
195 requirements
193 requirements
196 preserved: * (glob)
194 preserved: * (glob)
197 added: dirstate-tracked-key-v1
195 added: dirstate-tracked-key-v1
198
196
199 no revlogs to process
197 no revlogs to process
200
198
201 $ ls -1 .hg/dirstate-tracked-hint
199 $ test -f .hg/dirstate-tracked-hint
202 .hg/dirstate-tracked-hint
203 $ hg debugrequires | grep 'tracked'
200 $ hg debugrequires | grep 'tracked'
204 dirstate-tracked-key-v1
201 dirstate-tracked-key-v1
205 $ cd ..
202 $ cd ..
206
203
207 Test automatic upgrade and downgrade
204 Test automatic upgrade and downgrade
208 ------------------------------------
205 ------------------------------------
209
206
210 create an initial repository
207 create an initial repository
211
208
212 $ hg init auto-upgrade \
209 $ hg init auto-upgrade \
213 > --config format.use-dirstate-tracked-hint=no
210 > --config format.use-dirstate-tracked-hint=no
214 $ hg debugbuilddag -R auto-upgrade --new-file .+5
211 $ hg debugbuilddag -R auto-upgrade --new-file .+5
215 $ hg -R auto-upgrade update
212 $ hg -R auto-upgrade update
216 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 $ hg debugformat -R auto-upgrade | grep tracked
214 $ hg debugformat -R auto-upgrade | grep tracked
218 tracked-hint: no
215 tracked-hint: no
219
216
220 upgrade it to dirstate-tracked-hint automatically
217 upgrade it to dirstate-tracked-hint automatically
221
218
222 $ hg status -R auto-upgrade \
219 $ hg status -R auto-upgrade \
223 > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \
220 > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \
224 > --config format.use-dirstate-tracked-hint=yes
221 > --config format.use-dirstate-tracked-hint=yes
225 automatically upgrading repository to the `tracked-hint` feature
222 automatically upgrading repository to the `tracked-hint` feature
226 (see `hg help config.format.use-dirstate-tracked-hint` for details)
223 (see `hg help config.format.use-dirstate-tracked-hint` for details)
227 $ hg debugformat -R auto-upgrade | grep tracked
224 $ hg debugformat -R auto-upgrade | grep tracked
228 tracked-hint: yes
225 tracked-hint: yes
229
226
230 rhg supports this feature
227 rhg supports this feature
231
228
232 $ hg status -R auto-upgrade \
229 $ hg status -R auto-upgrade \
233 > --config format.use-dirstate-tracked-hint=yes --config rhg.on-unsupported=abort
230 > --config format.use-dirstate-tracked-hint=yes --config rhg.on-unsupported=abort
234
231
235 downgrade it from dirstate-tracked-hint automatically
232 downgrade it from dirstate-tracked-hint automatically
236
233
237 $ hg status -R auto-upgrade \
234 $ hg status -R auto-upgrade \
238 > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \
235 > --config format.use-dirstate-tracked-hint.automatic-upgrade-of-mismatching-repositories=yes \
239 > --config format.use-dirstate-tracked-hint=no
236 > --config format.use-dirstate-tracked-hint=no
240 automatically downgrading repository from the `tracked-hint` feature
237 automatically downgrading repository from the `tracked-hint` feature
241 (see `hg help config.format.use-dirstate-tracked-hint` for details)
238 (see `hg help config.format.use-dirstate-tracked-hint` for details)
242 $ hg debugformat -R auto-upgrade | grep tracked
239 $ hg debugformat -R auto-upgrade | grep tracked
243 tracked-hint: no
240 tracked-hint: no
General Comments 0
You need to be logged in to leave comments. Login now