Debian Codegraph @

tests/test-automv.t

raw
1 Tests for the automv extension; detect moved files at commit time.
2
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
5 > automv=
6 > rebase=
7 > EOF
8
9 Setup repo
10
11 $ hg init repo
12 $ cd repo
13
14 Test automv command for commit
15
16 $ printf 'foo\nbar\nbaz\n' > a.txt
17 $ hg add a.txt
18 $ hg commit -m 'init repo with a'
19
20 mv/rm/add
21 $ mv a.txt b.txt
22 $ hg rm a.txt
23 $ hg add b.txt
24 $ hg status -C
25 A b.txt
26 R a.txt
27 $ hg commit -m 'msg'
28 detected move of 1 files
29 $ hg status --change . -C
30 A b.txt
31 a.txt
32 R a.txt
33 $ hg up -r 0
34 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
35
36 mv/rm/add/modif
37 $ mv a.txt b.txt
38 $ hg rm a.txt
39 $ hg add b.txt
40 $ printf '\n' >> b.txt
41 $ hg status -C
42 A b.txt
43 R a.txt
44 $ hg commit -m 'msg'
45 detected move of 1 files
46 created new head
47 $ hg status --change . -C
48 A b.txt
49 a.txt
50 R a.txt
51 $ hg up -r 0
52 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
53
54 mv/rm/add/modif
55 $ mv a.txt b.txt
56 $ hg rm a.txt
57 $ hg add b.txt
58 $ printf '\nfoo\n' >> b.txt
59 $ hg status -C
60 A b.txt
61 R a.txt
62 $ hg commit -m 'msg'
63 created new head
64 $ hg status --change . -C
65 A b.txt
66 R a.txt
67 $ hg up -r 0
68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
69
70 mv/rm/add/modif/changethreshold
71 $ mv a.txt b.txt
72 $ hg rm a.txt
73 $ hg add b.txt
74 $ printf '\nfoo\n' >> b.txt
75 $ hg status -C
76 A b.txt
77 R a.txt
78 $ hg commit --config automv.similarity='60' -m 'msg'
79 detected move of 1 files
80 created new head
81 $ hg status --change . -C
82 A b.txt
83 a.txt
84 R a.txt
85 $ hg up -r 0
86 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
87
88 mv
89 $ mv a.txt b.txt
90 $ hg status -C
91 ! a.txt
92 ? b.txt
93 $ hg commit -m 'msg'
94 nothing changed (1 missing files, see 'hg status')
95 [1]
96 $ hg status -C
97 ! a.txt
98 ? b.txt
99 $ hg revert -aqC
100 $ rm b.txt
101
102 mv/rm/add/notincommitfiles
103 $ mv a.txt b.txt
104 $ hg rm a.txt
105 $ hg add b.txt
106 $ echo 'bar' > c.txt
107 $ hg add c.txt
108 $ hg status -C
109 A b.txt
110 A c.txt
111 R a.txt
112 $ hg commit c.txt -m 'msg'
113 created new head
114 $ hg status --change . -C
115 A c.txt
116 $ hg status -C
117 A b.txt
118 R a.txt
119 $ hg up -r 0
120 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 $ hg rm a.txt
122 $ echo 'bar' > c.txt
123 $ hg add c.txt
124 $ hg commit -m 'msg'
125 detected move of 1 files
126 created new head
127 $ hg status --change . -C
128 A b.txt
129 a.txt
130 A c.txt
131 R a.txt
132 $ hg up -r 0
133 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
134
135 mv/rm/add/--no-automv
136 $ mv a.txt b.txt
137 $ hg rm a.txt
138 $ hg add b.txt
139 $ hg status -C
140 A b.txt
141 R a.txt
142 $ hg commit --no-automv -m 'msg'
143 created new head
144 $ hg status --change . -C
145 A b.txt
146 R a.txt
147 $ hg up -r 0
148 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
149
150 Test automv command for commit --amend
151
152 mv/rm/add
153 $ echo 'c' > c.txt
154 $ hg add c.txt
155 $ hg commit -m 'revision to amend to'
156 created new head
157 $ mv a.txt b.txt
158 $ hg rm a.txt
159 $ hg add b.txt
160 $ hg status -C
161 A b.txt
162 R a.txt
163 $ hg commit --amend -m 'amended'
164 detected move of 1 files
165 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
166 $ hg status --change . -C
167 A b.txt
168 a.txt
169 A c.txt
170 R a.txt
171 $ hg up -r 0
172 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
173
174 mv/rm/add/modif
175 $ echo 'c' > c.txt
176 $ hg add c.txt
177 $ hg commit -m 'revision to amend to'
178 created new head
179 $ mv a.txt b.txt
180 $ hg rm a.txt
181 $ hg add b.txt
182 $ printf '\n' >> b.txt
183 $ hg status -C
184 A b.txt
185 R a.txt
186 $ hg commit --amend -m 'amended'
187 detected move of 1 files
188 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
189 $ hg status --change . -C
190 A b.txt
191 a.txt
192 A c.txt
193 R a.txt
194 $ hg up -r 0
195 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
196
197 mv/rm/add/modif
198 $ echo 'c' > c.txt
199 $ hg add c.txt
200 $ hg commit -m 'revision to amend to'
201 created new head
202 $ mv a.txt b.txt
203 $ hg rm a.txt
204 $ hg add b.txt
205 $ printf '\nfoo\n' >> b.txt
206 $ hg status -C
207 A b.txt
208 R a.txt
209 $ hg commit --amend -m 'amended'
210 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
211 $ hg status --change . -C
212 A b.txt
213 A c.txt
214 R a.txt
215 $ hg up -r 0
216 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
217
218 mv/rm/add/modif/changethreshold
219 $ echo 'c' > c.txt
220 $ hg add c.txt
221 $ hg commit -m 'revision to amend to'
222 created new head
223 $ mv a.txt b.txt
224 $ hg rm a.txt
225 $ hg add b.txt
226 $ printf '\nfoo\n' >> b.txt
227 $ hg status -C
228 A b.txt
229 R a.txt
230 $ hg commit --amend --config automv.similarity='60' -m 'amended'
231 detected move of 1 files
232 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
233 $ hg status --change . -C
234 A b.txt
235 a.txt
236 A c.txt
237 R a.txt
238 $ hg up -r 0
239 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
240
241 mv
242 $ echo 'c' > c.txt
243 $ hg add c.txt
244 $ hg commit -m 'revision to amend to'
245 created new head
246 $ mv a.txt b.txt
247 $ hg status -C
248 ! a.txt
249 ? b.txt
250 $ hg commit --amend -m 'amended'
251 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
252 $ hg status -C
253 ! a.txt
254 ? b.txt
255 $ hg up -Cr 0
256 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
257
258 mv/rm/add/notincommitfiles
259 $ echo 'c' > c.txt
260 $ hg add c.txt
261 $ hg commit -m 'revision to amend to'
262 created new head
263 $ mv a.txt b.txt
264 $ hg rm a.txt
265 $ hg add b.txt
266 $ echo 'bar' > d.txt
267 $ hg add d.txt
268 $ hg status -C
269 A b.txt
270 A d.txt
271 R a.txt
272 $ hg commit --amend -m 'amended' d.txt
273 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
274 $ hg status --change . -C
275 A c.txt
276 A d.txt
277 $ hg status -C
278 A b.txt
279 R a.txt
280 $ hg commit --amend -m 'amended'
281 detected move of 1 files
282 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
283 $ hg status --change . -C
284 A b.txt
285 a.txt
286 A c.txt
287 A d.txt
288 R a.txt
289 $ hg up -r 0
290 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
291
292 mv/rm/add/--no-automv
293 $ echo 'c' > c.txt
294 $ hg add c.txt
295 $ hg commit -m 'revision to amend to'
296 created new head
297 $ mv a.txt b.txt
298 $ hg rm a.txt
299 $ hg add b.txt
300 $ hg status -C
301 A b.txt
302 R a.txt
303 $ hg commit --amend -m 'amended' --no-automv
304 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
305 $ hg status --change . -C
306 A b.txt
307 A c.txt
308 R a.txt
309 $ hg up -r 0
310 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
311
312 mv/rm/commit/add/amend
313 $ echo 'c' > c.txt
314 $ hg add c.txt
315 $ hg commit -m 'revision to amend to'
316 created new head
317 $ mv a.txt b.txt
318 $ hg rm a.txt
319 $ hg status -C
320 R a.txt
321 ? b.txt
322 $ hg commit -m "removed a"
323 $ hg add b.txt
324 $ hg commit --amend -m 'amended'
325 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
326 $ hg status --change . -C
327 A b.txt
328 R a.txt
329
330 error conditions
331
332 $ cat >> $HGRCPATH << EOF
333 > [automv]
334 > similarity=110
335 > EOF
336 $ hg commit -m 'revision to amend to'
337 abort: automv.similarity must be between 0 and 100
338 [255]