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