Show More
@@ -1,423 +1,436 b'' | |||
|
1 | 1 | Revert interactive tests |
|
2 | 2 | 1 add and commit file f |
|
3 | 3 | 2 add commit file folder1/g |
|
4 | 4 | 3 add and commit file folder2/h |
|
5 | 5 | 4 add and commit file folder1/i |
|
6 | 6 | 5 commit change to file f |
|
7 | 7 | 6 commit changes to files folder1/g folder2/h |
|
8 | 8 | 7 commit changes to files folder1/g folder2/h |
|
9 | 9 | 8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and |
|
10 | 10 | 9 make workdir match 7 |
|
11 | 11 | 10 run the same test than 8 from within folder1 and check same expectations |
|
12 | 12 | |
|
13 | 13 | $ cat <<EOF >> $HGRCPATH |
|
14 | 14 | > [ui] |
|
15 | 15 | > interactive = true |
|
16 | 16 | > [extensions] |
|
17 | 17 | > record = |
|
18 | 18 | > purge = |
|
19 | 19 | > EOF |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | $ mkdir -p a/folder1 a/folder2 |
|
23 | 23 | $ cd a |
|
24 | 24 | $ hg init |
|
25 | 25 | >>> open('f', 'wb').write("1\n2\n3\n4\n5\n") |
|
26 | 26 | $ hg add f ; hg commit -m "adding f" |
|
27 | 27 | $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g" |
|
28 | 28 | $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h" |
|
29 | 29 | $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i" |
|
30 | 30 | >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n") |
|
31 | 31 | $ hg commit -m "modifying f" |
|
32 | 32 | >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n") |
|
33 | 33 | $ hg commit -m "modifying folder1/g" |
|
34 | 34 | >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n") |
|
35 | 35 | $ hg commit -m "modifying folder2/h" |
|
36 | 36 | $ hg tip |
|
37 | 37 | changeset: 6:59dd6e4ab63a |
|
38 | 38 | tag: tip |
|
39 | 39 | user: test |
|
40 | 40 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
41 | 41 | summary: modifying folder2/h |
|
42 | 42 | |
|
43 | 43 | $ hg revert -i -r 2 --all -- << EOF |
|
44 | 44 | > y |
|
45 | 45 | > y |
|
46 | 46 | > y |
|
47 | 47 | > y |
|
48 | 48 | > y |
|
49 | 49 | > ? |
|
50 | 50 | > y |
|
51 | 51 | > n |
|
52 | 52 | > n |
|
53 | 53 | > EOF |
|
54 | 54 | reverting f |
|
55 | 55 | reverting folder1/g |
|
56 | 56 | removing folder1/i |
|
57 | 57 | reverting folder2/h |
|
58 | 58 | remove added file folder1/i (Yn)? y |
|
59 | 59 | diff --git a/f b/f |
|
60 | 60 | 2 hunks, 2 lines changed |
|
61 | 61 | examine changes to 'f'? [Ynesfdaq?] y |
|
62 | 62 | |
|
63 | 63 | @@ -1,6 +1,5 @@ |
|
64 | 64 | -a |
|
65 | 65 | 1 |
|
66 | 66 | 2 |
|
67 | 67 | 3 |
|
68 | 68 | 4 |
|
69 | 69 | 5 |
|
70 | 70 | apply change 1/6 to 'f'? [Ynesfdaq?] y |
|
71 | 71 | |
|
72 | 72 | @@ -2,6 +1,5 @@ |
|
73 | 73 | 1 |
|
74 | 74 | 2 |
|
75 | 75 | 3 |
|
76 | 76 | 4 |
|
77 | 77 | 5 |
|
78 | 78 | -b |
|
79 | 79 | apply change 2/6 to 'f'? [Ynesfdaq?] y |
|
80 | 80 | |
|
81 | 81 | diff --git a/folder1/g b/folder1/g |
|
82 | 82 | 2 hunks, 2 lines changed |
|
83 | 83 | examine changes to 'folder1/g'? [Ynesfdaq?] y |
|
84 | 84 | |
|
85 | 85 | @@ -1,6 +1,5 @@ |
|
86 | 86 | -c |
|
87 | 87 | 1 |
|
88 | 88 | 2 |
|
89 | 89 | 3 |
|
90 | 90 | 4 |
|
91 | 91 | 5 |
|
92 | 92 | apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ? |
|
93 | 93 | |
|
94 | 94 | y - yes, apply this change |
|
95 | 95 | n - no, skip this change |
|
96 | 96 | e - edit this change manually |
|
97 | 97 | s - skip remaining changes to this file |
|
98 | 98 | f - apply remaining changes to this file |
|
99 | 99 | d - done, skip remaining changes and files |
|
100 | 100 | a - apply all changes to all remaining files |
|
101 | 101 | q - quit, applying no changes |
|
102 | 102 | ? - ? (display help) |
|
103 | 103 | apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y |
|
104 | 104 | |
|
105 | 105 | @@ -2,6 +1,5 @@ |
|
106 | 106 | 1 |
|
107 | 107 | 2 |
|
108 | 108 | 3 |
|
109 | 109 | 4 |
|
110 | 110 | 5 |
|
111 | 111 | -d |
|
112 | 112 | apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n |
|
113 | 113 | |
|
114 | 114 | diff --git a/folder2/h b/folder2/h |
|
115 | 115 | 2 hunks, 2 lines changed |
|
116 | 116 | examine changes to 'folder2/h'? [Ynesfdaq?] n |
|
117 | 117 | |
|
118 | 118 | $ cat f |
|
119 | 119 | 1 |
|
120 | 120 | 2 |
|
121 | 121 | 3 |
|
122 | 122 | 4 |
|
123 | 123 | 5 |
|
124 | 124 | $ cat folder1/g |
|
125 | 125 | 1 |
|
126 | 126 | 2 |
|
127 | 127 | 3 |
|
128 | 128 | 4 |
|
129 | 129 | 5 |
|
130 | 130 | d |
|
131 | 131 | $ cat folder2/h |
|
132 | 132 | e |
|
133 | 133 | 1 |
|
134 | 134 | 2 |
|
135 | 135 | 3 |
|
136 | 136 | 4 |
|
137 | 137 | 5 |
|
138 | 138 | f |
|
139 | 139 | |
|
140 | 140 | Test that --interactive lift the need for --all |
|
141 | 141 | |
|
142 | 142 | $ echo q | hg revert -i -r 2 |
|
143 | 143 | reverting folder1/g |
|
144 | 144 | reverting folder2/h |
|
145 | 145 | diff --git a/folder1/g b/folder1/g |
|
146 | 146 | 1 hunks, 1 lines changed |
|
147 | 147 | examine changes to 'folder1/g'? [Ynesfdaq?] q |
|
148 | 148 | |
|
149 | 149 | abort: user quit |
|
150 | 150 | [255] |
|
151 | 151 | $ ls folder1/ |
|
152 | 152 | g |
|
153 | 153 | |
|
154 | 154 | Test that a noop revert doesn't do an unnecessary backup |
|
155 | 155 | $ (echo y; echo n) | hg revert -i -r 2 folder1/g |
|
156 | 156 | diff --git a/folder1/g b/folder1/g |
|
157 | 157 | 1 hunks, 1 lines changed |
|
158 | 158 | examine changes to 'folder1/g'? [Ynesfdaq?] y |
|
159 | 159 | |
|
160 | 160 | @@ -3,4 +3,3 @@ |
|
161 | 161 | 3 |
|
162 | 162 | 4 |
|
163 | 163 | 5 |
|
164 | 164 | -d |
|
165 | 165 | apply this change to 'folder1/g'? [Ynesfdaq?] n |
|
166 | 166 | |
|
167 | 167 | $ ls folder1/ |
|
168 | 168 | g |
|
169 | 169 | |
|
170 | 170 | Test --no-backup |
|
171 | 171 | $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g |
|
172 | 172 | diff --git a/folder1/g b/folder1/g |
|
173 | 173 | 1 hunks, 1 lines changed |
|
174 | 174 | examine changes to 'folder1/g'? [Ynesfdaq?] y |
|
175 | 175 | |
|
176 | 176 | @@ -3,4 +3,3 @@ |
|
177 | 177 | 3 |
|
178 | 178 | 4 |
|
179 | 179 | 5 |
|
180 | 180 | -d |
|
181 | 181 | apply this change to 'folder1/g'? [Ynesfdaq?] y |
|
182 | 182 | |
|
183 | 183 | $ ls folder1/ |
|
184 | 184 | g |
|
185 | 185 | >>> open('folder1/g', 'wb').write("1\n2\n3\n4\n5\nd\n") |
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | $ hg update -C 6 |
|
189 | 189 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
190 | 190 | $ hg revert -i -r 2 --all -- << EOF |
|
191 | 191 | > n |
|
192 | 192 | > y |
|
193 | 193 | > y |
|
194 | 194 | > y |
|
195 | 195 | > y |
|
196 | 196 | > y |
|
197 | 197 | > n |
|
198 | 198 | > n |
|
199 | 199 | > EOF |
|
200 | 200 | reverting f |
|
201 | 201 | reverting folder1/g |
|
202 | 202 | removing folder1/i |
|
203 | 203 | reverting folder2/h |
|
204 | 204 | remove added file folder1/i (Yn)? n |
|
205 | 205 | diff --git a/f b/f |
|
206 | 206 | 2 hunks, 2 lines changed |
|
207 | 207 | examine changes to 'f'? [Ynesfdaq?] y |
|
208 | 208 | |
|
209 | 209 | @@ -1,6 +1,5 @@ |
|
210 | 210 | -a |
|
211 | 211 | 1 |
|
212 | 212 | 2 |
|
213 | 213 | 3 |
|
214 | 214 | 4 |
|
215 | 215 | 5 |
|
216 | 216 | apply change 1/6 to 'f'? [Ynesfdaq?] y |
|
217 | 217 | |
|
218 | 218 | @@ -2,6 +1,5 @@ |
|
219 | 219 | 1 |
|
220 | 220 | 2 |
|
221 | 221 | 3 |
|
222 | 222 | 4 |
|
223 | 223 | 5 |
|
224 | 224 | -b |
|
225 | 225 | apply change 2/6 to 'f'? [Ynesfdaq?] y |
|
226 | 226 | |
|
227 | 227 | diff --git a/folder1/g b/folder1/g |
|
228 | 228 | 2 hunks, 2 lines changed |
|
229 | 229 | examine changes to 'folder1/g'? [Ynesfdaq?] y |
|
230 | 230 | |
|
231 | 231 | @@ -1,6 +1,5 @@ |
|
232 | 232 | -c |
|
233 | 233 | 1 |
|
234 | 234 | 2 |
|
235 | 235 | 3 |
|
236 | 236 | 4 |
|
237 | 237 | 5 |
|
238 | 238 | apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y |
|
239 | 239 | |
|
240 | 240 | @@ -2,6 +1,5 @@ |
|
241 | 241 | 1 |
|
242 | 242 | 2 |
|
243 | 243 | 3 |
|
244 | 244 | 4 |
|
245 | 245 | 5 |
|
246 | 246 | -d |
|
247 | 247 | apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n |
|
248 | 248 | |
|
249 | 249 | diff --git a/folder2/h b/folder2/h |
|
250 | 250 | 2 hunks, 2 lines changed |
|
251 | 251 | examine changes to 'folder2/h'? [Ynesfdaq?] n |
|
252 | 252 | |
|
253 | 253 | $ cat f |
|
254 | 254 | 1 |
|
255 | 255 | 2 |
|
256 | 256 | 3 |
|
257 | 257 | 4 |
|
258 | 258 | 5 |
|
259 | 259 | $ cat folder1/g |
|
260 | 260 | 1 |
|
261 | 261 | 2 |
|
262 | 262 | 3 |
|
263 | 263 | 4 |
|
264 | 264 | 5 |
|
265 | 265 | d |
|
266 | 266 | $ cat folder2/h |
|
267 | 267 | e |
|
268 | 268 | 1 |
|
269 | 269 | 2 |
|
270 | 270 | 3 |
|
271 | 271 | 4 |
|
272 | 272 | 5 |
|
273 | 273 | f |
|
274 | 274 | $ hg st |
|
275 | 275 | M f |
|
276 | 276 | M folder1/g |
|
277 | 277 | $ hg revert --interactive f << EOF |
|
278 | 278 | > y |
|
279 | 279 | > ? |
|
280 | 280 | > y |
|
281 | 281 | > n |
|
282 | 282 | > n |
|
283 | 283 | > EOF |
|
284 | 284 | diff --git a/f b/f |
|
285 | 285 | 2 hunks, 2 lines changed |
|
286 | 286 | examine changes to 'f'? [Ynesfdaq?] y |
|
287 | 287 | |
|
288 | 288 | @@ -1,6 +1,5 @@ |
|
289 | 289 | -a |
|
290 | 290 | 1 |
|
291 | 291 | 2 |
|
292 | 292 | 3 |
|
293 | 293 | 4 |
|
294 | 294 | 5 |
|
295 | 295 | discard change 1/2 to 'f'? [Ynesfdaq?] ? |
|
296 | 296 | |
|
297 | 297 | y - yes, discard this change |
|
298 | 298 | n - no, skip this change |
|
299 | 299 | e - edit this change manually |
|
300 | 300 | s - skip remaining changes to this file |
|
301 | 301 | f - discard remaining changes to this file |
|
302 | 302 | d - done, skip remaining changes and files |
|
303 | 303 | a - discard all changes to all remaining files |
|
304 | 304 | q - quit, discarding no changes |
|
305 | 305 | ? - ? (display help) |
|
306 | 306 | discard change 1/2 to 'f'? [Ynesfdaq?] y |
|
307 | 307 | |
|
308 | 308 | @@ -2,6 +1,5 @@ |
|
309 | 309 | 1 |
|
310 | 310 | 2 |
|
311 | 311 | 3 |
|
312 | 312 | 4 |
|
313 | 313 | 5 |
|
314 | 314 | -b |
|
315 | 315 | discard change 2/2 to 'f'? [Ynesfdaq?] n |
|
316 | 316 | |
|
317 | 317 | $ hg st |
|
318 | 318 | M f |
|
319 | 319 | M folder1/g |
|
320 | 320 | ? f.orig |
|
321 | 321 | $ cat f |
|
322 | 322 | a |
|
323 | 323 | 1 |
|
324 | 324 | 2 |
|
325 | 325 | 3 |
|
326 | 326 | 4 |
|
327 | 327 | 5 |
|
328 | 328 | $ cat f.orig |
|
329 | 329 | 1 |
|
330 | 330 | 2 |
|
331 | 331 | 3 |
|
332 | 332 | 4 |
|
333 | 333 | 5 |
|
334 | 334 | $ rm f.orig |
|
335 | 335 | $ hg update -C . |
|
336 | 336 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
337 | 337 | |
|
338 | 338 | Check editing files newly added by a revert |
|
339 | 339 | |
|
340 | 340 | 1) Create a dummy editor changing 1 to 42 |
|
341 | 341 | $ cat > $TESTTMP/editor.sh << '__EOF__' |
|
342 | 342 | > cat "$1" | sed "s/1/42/g" > tt |
|
343 | 343 | > mv tt "$1" |
|
344 | 344 | > __EOF__ |
|
345 | 345 | |
|
346 | 346 | 2) Add k |
|
347 | 347 | $ printf "1\n" > k |
|
348 | 348 | $ hg add k |
|
349 | 349 | $ hg commit -m "add k" |
|
350 | 350 | |
|
351 | 351 | 3) Use interactive revert with editing (replacing +1 with +42): |
|
352 | 352 | $ printf "0\n2\n" > k |
|
353 | 353 | $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i <<EOF |
|
354 | 354 | > y |
|
355 | 355 | > e |
|
356 | 356 | > EOF |
|
357 | 357 | reverting k |
|
358 | 358 | diff --git a/k b/k |
|
359 | 359 | 1 hunks, 2 lines changed |
|
360 | 360 | examine changes to 'k'? [Ynesfdaq?] y |
|
361 | 361 | |
|
362 | 362 | @@ -1,1 +1,2 @@ |
|
363 | 363 | -1 |
|
364 | 364 | +0 |
|
365 | 365 | +2 |
|
366 | 366 | discard this change to 'k'? [Ynesfdaq?] e |
|
367 | 367 | |
|
368 | 368 | $ cat k |
|
369 | 369 | 42 |
|
370 | 370 | |
|
371 | 371 | $ hg update -C . |
|
372 | 372 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
373 | 373 | $ hg purge |
|
374 | 374 | $ touch newfile |
|
375 | 375 | $ hg add newfile |
|
376 | 376 | $ hg status |
|
377 | 377 | A newfile |
|
378 | 378 | $ hg revert -i <<EOF |
|
379 | 379 | > n |
|
380 | 380 | > EOF |
|
381 | 381 | forgetting newfile |
|
382 | 382 | forget added file newfile (Yn)? n |
|
383 | 383 | $ hg status |
|
384 | 384 | A newfile |
|
385 | 385 | $ hg revert -i <<EOF |
|
386 | 386 | > y |
|
387 | 387 | > EOF |
|
388 | 388 | forgetting newfile |
|
389 | 389 | forget added file newfile (Yn)? y |
|
390 | 390 | $ hg status |
|
391 | 391 | ? newfile |
|
392 | 392 | |
|
393 | 393 | When a line without EOL is selected during "revert -i" (issue5651) |
|
394 | 394 | |
|
395 | 395 | $ hg init $TESTTMP/revert-i-eol |
|
396 | 396 | $ cd $TESTTMP/revert-i-eol |
|
397 | 397 | $ echo 0 > a |
|
398 | 398 | $ hg ci -qAm 0 |
|
399 | 399 | $ printf 1 >> a |
|
400 | 400 | $ hg ci -qAm 1 |
|
401 | 401 | $ cat a |
|
402 | 402 | 0 |
|
403 | 403 | 1 (no-eol) |
|
404 | 404 | |
|
405 | 405 | $ hg revert -ir'.^' <<EOF |
|
406 | 406 | > y |
|
407 | 407 | > y |
|
408 | 408 | > EOF |
|
409 | 409 | reverting a |
|
410 | 410 | diff --git a/a b/a |
|
411 | 411 | 1 hunks, 1 lines changed |
|
412 | 412 | examine changes to 'a'? [Ynesfdaq?] y |
|
413 | 413 | |
|
414 | 414 | @@ -1,2 +1,1 @@ |
|
415 | 415 | 0 |
|
416 | 416 | -1 |
|
417 | 417 | \ No newline at end of file |
|
418 | 418 | apply this change to 'a'? [Ynesfdaq?] y |
|
419 | 419 | |
|
420 | 420 | $ cat a |
|
421 | 421 | 0 |
|
422 | 422 | |
|
423 | When specified pattern does not exist, we should exit early (issue5789). | |
|
424 | ||
|
425 | $ hg files | |
|
426 | a | |
|
427 | $ hg rev b | |
|
428 | b: no such file in rev b40d1912accf | |
|
429 | $ hg rev -i b | |
|
430 | b: no such file in rev b40d1912accf | |
|
431 | diff --git a/a b/a | |
|
432 | 1 hunks, 1 lines changed | |
|
433 | examine changes to 'a'? [Ynesfdaq?] abort: response expected | |
|
434 | [255] | |
|
435 | ||
|
423 | 436 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now