Show More
@@ -1,423 +1,450 b'' | |||
|
1 | 1 | Test for command `hg unamend` which lives in uncommit extension |
|
2 | 2 | =============================================================== |
|
3 | 3 | |
|
4 | 4 | $ cat >> $HGRCPATH << EOF |
|
5 | 5 | > [alias] |
|
6 | 6 | > glog = log -G -T '{rev}:{node|short} {desc}' |
|
7 | 7 | > [experimental] |
|
8 | 8 | > evolution = createmarkers, allowunstable |
|
9 | 9 | > evolution.allowdivergence = true |
|
10 | 10 | > [extensions] |
|
11 | 11 | > rebase = |
|
12 | 12 | > amend = |
|
13 | 13 | > uncommit = |
|
14 | 14 | > EOF |
|
15 | 15 | |
|
16 | 16 | Repo Setup |
|
17 | 17 | |
|
18 | 18 | $ hg init repo |
|
19 | 19 | $ cd repo |
|
20 | 20 | $ for ch in a b c d e f g h; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; done |
|
21 | 21 | |
|
22 | 22 | $ hg glog |
|
23 | 23 | @ 7:ec2426147f0e Added h |
|
24 | 24 | | |
|
25 | 25 | o 6:87d6d6676308 Added g |
|
26 | 26 | | |
|
27 | 27 | o 5:825660c69f0c Added f |
|
28 | 28 | | |
|
29 | 29 | o 4:aa98ab95a928 Added e |
|
30 | 30 | | |
|
31 | 31 | o 3:62615734edd5 Added d |
|
32 | 32 | | |
|
33 | 33 | o 2:28ad74487de9 Added c |
|
34 | 34 | | |
|
35 | 35 | o 1:29becc82797a Added b |
|
36 | 36 | | |
|
37 | 37 | o 0:18d04c59bb5d Added a |
|
38 | 38 | |
|
39 | 39 | Trying to unamend when there was no amend done |
|
40 | 40 | |
|
41 | 41 | $ hg unamend |
|
42 | 42 | abort: changeset must have one predecessor, found 0 predecessors |
|
43 | 43 | [10] |
|
44 | 44 | |
|
45 | 45 | Unamend on clean wdir and tip |
|
46 | 46 | |
|
47 | 47 | $ echo "bar" >> h |
|
48 | 48 | $ hg amend |
|
49 | 49 | |
|
50 | 50 | $ hg exp |
|
51 | 51 | # HG changeset patch |
|
52 | 52 | # User test |
|
53 | 53 | # Date 0 0 |
|
54 | 54 | # Thu Jan 01 00:00:00 1970 +0000 |
|
55 | 55 | # Node ID c9fa1a715c1b7661c0fafb362a9f30bd75878d7d |
|
56 | 56 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
57 | 57 | Added h |
|
58 | 58 | |
|
59 | 59 | diff -r 87d6d6676308 -r c9fa1a715c1b h |
|
60 | 60 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
61 | 61 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
62 | 62 | @@ -0,0 +1,2 @@ |
|
63 | 63 | +foo |
|
64 | 64 | +bar |
|
65 | 65 | |
|
66 | 66 | $ hg glog --hidden |
|
67 | 67 | @ 8:c9fa1a715c1b Added h |
|
68 | 68 | | |
|
69 | 69 | | x 7:ec2426147f0e Added h |
|
70 | 70 | |/ |
|
71 | 71 | o 6:87d6d6676308 Added g |
|
72 | 72 | | |
|
73 | 73 | o 5:825660c69f0c Added f |
|
74 | 74 | | |
|
75 | 75 | o 4:aa98ab95a928 Added e |
|
76 | 76 | | |
|
77 | 77 | o 3:62615734edd5 Added d |
|
78 | 78 | | |
|
79 | 79 | o 2:28ad74487de9 Added c |
|
80 | 80 | | |
|
81 | 81 | o 1:29becc82797a Added b |
|
82 | 82 | | |
|
83 | 83 | o 0:18d04c59bb5d Added a |
|
84 | 84 | |
|
85 | 85 | $ hg unamend |
|
86 | 86 | $ hg glog --hidden |
|
87 | 87 | @ 9:46d02d47eec6 Added h |
|
88 | 88 | | |
|
89 | 89 | | x 8:c9fa1a715c1b Added h |
|
90 | 90 | |/ |
|
91 | 91 | | x 7:ec2426147f0e Added h |
|
92 | 92 | |/ |
|
93 | 93 | o 6:87d6d6676308 Added g |
|
94 | 94 | | |
|
95 | 95 | o 5:825660c69f0c Added f |
|
96 | 96 | | |
|
97 | 97 | o 4:aa98ab95a928 Added e |
|
98 | 98 | | |
|
99 | 99 | o 3:62615734edd5 Added d |
|
100 | 100 | | |
|
101 | 101 | o 2:28ad74487de9 Added c |
|
102 | 102 | | |
|
103 | 103 | o 1:29becc82797a Added b |
|
104 | 104 | | |
|
105 | 105 | o 0:18d04c59bb5d Added a |
|
106 | 106 | |
|
107 | 107 | $ hg diff |
|
108 | 108 | diff -r 46d02d47eec6 h |
|
109 | 109 | --- a/h Thu Jan 01 00:00:00 1970 +0000 |
|
110 | 110 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
111 | 111 | @@ -1,1 +1,2 @@ |
|
112 | 112 | foo |
|
113 | 113 | +bar |
|
114 | 114 | |
|
115 | 115 | $ hg exp |
|
116 | 116 | # HG changeset patch |
|
117 | 117 | # User test |
|
118 | 118 | # Date 0 0 |
|
119 | 119 | # Thu Jan 01 00:00:00 1970 +0000 |
|
120 | 120 | # Node ID 46d02d47eec6ca096b8dcab3f8f5579c40c3dd9a |
|
121 | 121 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
122 | 122 | Added h |
|
123 | 123 | |
|
124 | 124 | diff -r 87d6d6676308 -r 46d02d47eec6 h |
|
125 | 125 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
126 | 126 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
127 | 127 | @@ -0,0 +1,1 @@ |
|
128 | 128 | +foo |
|
129 | 129 | |
|
130 | 130 | $ hg status |
|
131 | 131 | M h |
|
132 | 132 | |
|
133 | 133 | $ hg log -r . -T '{extras % "{extra}\n"}' --config alias.log=log |
|
134 | 134 | branch=default |
|
135 | 135 | unamend_source=c9fa1a715c1b7661c0fafb362a9f30bd75878d7d |
|
136 | 136 | |
|
137 | 137 | Using unamend to undo an unamed (intentional) |
|
138 | 138 | |
|
139 | 139 | $ hg unamend |
|
140 | 140 | $ hg exp |
|
141 | 141 | # HG changeset patch |
|
142 | 142 | # User test |
|
143 | 143 | # Date 0 0 |
|
144 | 144 | # Thu Jan 01 00:00:00 1970 +0000 |
|
145 | 145 | # Node ID 850ddfc1bc662997ec6094ada958f01f0cc8070a |
|
146 | 146 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
147 | 147 | Added h |
|
148 | 148 | |
|
149 | 149 | diff -r 87d6d6676308 -r 850ddfc1bc66 h |
|
150 | 150 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
151 | 151 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
152 | 152 | @@ -0,0 +1,2 @@ |
|
153 | 153 | +foo |
|
154 | 154 | +bar |
|
155 | 155 | $ hg diff |
|
156 | 156 | |
|
157 | 157 | Unamend on a dirty working directory |
|
158 | 158 | |
|
159 | 159 | $ echo "bar" >> a |
|
160 | 160 | $ hg amend |
|
161 | 161 | $ echo "foobar" >> a |
|
162 | 162 | $ echo "bar" >> b |
|
163 | 163 | $ hg status |
|
164 | 164 | M a |
|
165 | 165 | M b |
|
166 | 166 | |
|
167 | 167 | $ hg unamend |
|
168 | 168 | |
|
169 | 169 | $ hg status |
|
170 | 170 | M a |
|
171 | 171 | M b |
|
172 | 172 | |
|
173 | 173 | $ hg diff |
|
174 | 174 | diff -r ec338db45d51 a |
|
175 | 175 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
176 | 176 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
177 | 177 | @@ -1,1 +1,3 @@ |
|
178 | 178 | foo |
|
179 | 179 | +bar |
|
180 | 180 | +foobar |
|
181 | 181 | diff -r ec338db45d51 b |
|
182 | 182 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
183 | 183 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
184 | 184 | @@ -1,1 +1,2 @@ |
|
185 | 185 | foo |
|
186 | 186 | +bar |
|
187 | 187 | |
|
188 | 188 | Unamending an added file |
|
189 | 189 | |
|
190 | 190 | $ hg ci -m "Added things to a and b" |
|
191 | 191 | $ echo foo > bar |
|
192 | 192 | $ hg add bar |
|
193 | 193 | $ hg amend |
|
194 | 194 | |
|
195 | 195 | $ hg unamend |
|
196 | 196 | $ hg status |
|
197 | 197 | A bar |
|
198 | 198 | |
|
199 | 199 | $ hg revert --all |
|
200 | 200 | forgetting bar |
|
201 | 201 | |
|
202 | 202 | Unamending a removed file |
|
203 | 203 | |
|
204 | 204 | $ hg remove a |
|
205 | 205 | $ hg amend |
|
206 | 206 | |
|
207 | 207 | $ hg unamend |
|
208 | 208 | $ hg status |
|
209 | 209 | R a |
|
210 | 210 | ? bar |
|
211 | 211 | |
|
212 | 212 | $ hg revert --all |
|
213 | 213 | undeleting a |
|
214 | 214 | |
|
215 | 215 | Unamending an added file with dirty wdir status |
|
216 | 216 | |
|
217 | 217 | $ hg add bar |
|
218 | 218 | $ hg amend |
|
219 | 219 | $ echo bar >> bar |
|
220 | 220 | $ hg status |
|
221 | 221 | M bar |
|
222 | 222 | |
|
223 | 223 | $ hg unamend |
|
224 | 224 | $ hg status |
|
225 | 225 | A bar |
|
226 | 226 | $ hg diff |
|
227 | 227 | diff -r 7f79409af972 bar |
|
228 | 228 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
229 | 229 | +++ b/bar Thu Jan 01 00:00:00 1970 +0000 |
|
230 | 230 | @@ -0,0 +1,2 @@ |
|
231 | 231 | +foo |
|
232 | 232 | +bar |
|
233 | 233 | |
|
234 | 234 | $ hg revert --all |
|
235 | 235 | forgetting bar |
|
236 | 236 | $ rm bar |
|
237 | 237 | |
|
238 | 238 | Unamending in middle of a stack |
|
239 | 239 | |
|
240 | 240 | $ hg glog |
|
241 | 241 | @ 19:7f79409af972 Added things to a and b |
|
242 | 242 | | |
|
243 | 243 | o 12:ec338db45d51 Added h |
|
244 | 244 | | |
|
245 | 245 | o 6:87d6d6676308 Added g |
|
246 | 246 | | |
|
247 | 247 | o 5:825660c69f0c Added f |
|
248 | 248 | | |
|
249 | 249 | o 4:aa98ab95a928 Added e |
|
250 | 250 | | |
|
251 | 251 | o 3:62615734edd5 Added d |
|
252 | 252 | | |
|
253 | 253 | o 2:28ad74487de9 Added c |
|
254 | 254 | | |
|
255 | 255 | o 1:29becc82797a Added b |
|
256 | 256 | | |
|
257 | 257 | o 0:18d04c59bb5d Added a |
|
258 | 258 | |
|
259 | 259 | $ hg up 5 |
|
260 | 260 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
261 | 261 | $ echo bar >> f |
|
262 | 262 | $ hg amend |
|
263 | 263 | 3 new orphan changesets |
|
264 | 264 | $ hg rebase -s 6 -d . -q |
|
265 | 265 | |
|
266 | 266 | $ hg glog |
|
267 | 267 | o 23:03ddd6fc5af1 Added things to a and b |
|
268 | 268 | | |
|
269 | 269 | o 22:3e7b64ee157b Added h |
|
270 | 270 | | |
|
271 | 271 | o 21:49635b68477e Added g |
|
272 | 272 | | |
|
273 | 273 | @ 20:93f0e8ffab32 Added f |
|
274 | 274 | | |
|
275 | 275 | o 4:aa98ab95a928 Added e |
|
276 | 276 | | |
|
277 | 277 | o 3:62615734edd5 Added d |
|
278 | 278 | | |
|
279 | 279 | o 2:28ad74487de9 Added c |
|
280 | 280 | | |
|
281 | 281 | o 1:29becc82797a Added b |
|
282 | 282 | | |
|
283 | 283 | o 0:18d04c59bb5d Added a |
|
284 | 284 | |
|
285 | 285 | |
|
286 | 286 | $ hg --config experimental.evolution=createmarkers unamend |
|
287 | 287 | abort: cannot unamend changeset, as that will orphan 3 descendants |
|
288 | 288 | (see 'hg help evolution.instability') |
|
289 | 289 | [10] |
|
290 | 290 | |
|
291 | 291 | $ hg unamend |
|
292 | 292 | 3 new orphan changesets |
|
293 | 293 | |
|
294 | 294 | Trying to unamend a public changeset |
|
295 | 295 | |
|
296 | 296 | $ hg up -C 23 |
|
297 | 297 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
298 | 298 | $ hg phase -r . -p |
|
299 | 299 | 1 new phase-divergent changesets |
|
300 | 300 | $ hg unamend |
|
301 | 301 | abort: cannot unamend public changesets: 03ddd6fc5af1 |
|
302 | 302 | (see 'hg help phases' for details) |
|
303 | 303 | [10] |
|
304 | 304 | |
|
305 | 305 | Testing whether unamend retains copies or not |
|
306 | 306 | |
|
307 | 307 | $ hg status |
|
308 | 308 | |
|
309 | 309 | $ hg mv a foo |
|
310 | 310 | |
|
311 | 311 | $ hg ci -m "Moved a to foo" |
|
312 | 312 | $ hg exp --git |
|
313 | 313 | # HG changeset patch |
|
314 | 314 | # User test |
|
315 | 315 | # Date 0 0 |
|
316 | 316 | # Thu Jan 01 00:00:00 1970 +0000 |
|
317 | 317 | # Node ID cfef290346fbee5126313d7e1aab51d877679b09 |
|
318 | 318 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
319 | 319 | Moved a to foo |
|
320 | 320 | |
|
321 | 321 | diff --git a/a b/foo |
|
322 | 322 | rename from a |
|
323 | 323 | rename to foo |
|
324 | 324 | |
|
325 | 325 | $ hg mv b foobar |
|
326 | 326 | $ hg diff --git |
|
327 | 327 | diff --git a/b b/foobar |
|
328 | 328 | rename from b |
|
329 | 329 | rename to foobar |
|
330 | 330 | $ hg amend |
|
331 | 331 | |
|
332 | 332 | $ hg exp --git |
|
333 | 333 | # HG changeset patch |
|
334 | 334 | # User test |
|
335 | 335 | # Date 0 0 |
|
336 | 336 | # Thu Jan 01 00:00:00 1970 +0000 |
|
337 | 337 | # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3 |
|
338 | 338 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
339 | 339 | Moved a to foo |
|
340 | 340 | |
|
341 | 341 | diff --git a/a b/foo |
|
342 | 342 | rename from a |
|
343 | 343 | rename to foo |
|
344 | 344 | diff --git a/b b/foobar |
|
345 | 345 | rename from b |
|
346 | 346 | rename to foobar |
|
347 | 347 | |
|
348 | 348 | $ hg mv c wat |
|
349 | 349 | $ hg unamend |
|
350 | 350 | |
|
351 | 351 | $ hg verify -v |
|
352 | 352 | repository uses revlog format 1 |
|
353 | 353 | checking changesets |
|
354 | 354 | checking manifests |
|
355 | 355 | crosschecking files in changesets and manifests |
|
356 | 356 | checking files |
|
357 | 357 | checked 28 changesets with 16 changes to 11 files |
|
358 | 358 | |
|
359 | 359 | Retained copies in new prdecessor commit |
|
360 | 360 | |
|
361 | 361 | $ hg exp --git |
|
362 | 362 | # HG changeset patch |
|
363 | 363 | # User test |
|
364 | 364 | # Date 0 0 |
|
365 | 365 | # Thu Jan 01 00:00:00 1970 +0000 |
|
366 | 366 | # Node ID 552e3af4f01f620f88ca27be1f898316235b736a |
|
367 | 367 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
368 | 368 | Moved a to foo |
|
369 | 369 | |
|
370 | 370 | diff --git a/a b/foo |
|
371 | 371 | rename from a |
|
372 | 372 | rename to foo |
|
373 | 373 | |
|
374 | 374 | Retained copies in working directoy |
|
375 | 375 | |
|
376 | 376 | $ hg diff --git |
|
377 | 377 | diff --git a/b b/foobar |
|
378 | 378 | rename from b |
|
379 | 379 | rename to foobar |
|
380 | 380 | diff --git a/c b/wat |
|
381 | 381 | rename from c |
|
382 | 382 | rename to wat |
|
383 | 383 | $ hg revert -qa |
|
384 | 384 | $ rm foobar wat |
|
385 | 385 | |
|
386 | 386 | Rename a->b, then amend b->c. After unamend, should look like b->c. |
|
387 | 387 | |
|
388 | 388 | $ hg co -q 0 |
|
389 | 389 | $ hg mv a b |
|
390 | 390 | $ hg ci -qm 'move to a b' |
|
391 | 391 | $ hg mv b c |
|
392 | 392 | $ hg amend |
|
393 | 393 | $ hg unamend |
|
394 | 394 | $ hg st --copies --change . |
|
395 | 395 | A b |
|
396 | 396 | a |
|
397 | 397 | R a |
|
398 | 398 | $ hg st --copies |
|
399 | 399 | A c |
|
400 | 400 | b |
|
401 | 401 | R b |
|
402 | 402 | $ hg revert -qa |
|
403 | 403 | $ rm c |
|
404 | 404 | |
|
405 | 405 | Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d |
|
406 | 406 | |
|
407 | 407 | $ hg co -q 0 |
|
408 | 408 | $ hg mv a b |
|
409 | 409 | $ hg ci -qm 'move to a b' |
|
410 | 410 | warning: commit already existed in the repository! |
|
411 | 411 | $ hg mv b c |
|
412 | 412 | $ hg amend |
|
413 | 413 | warning: commit already existed in the repository! |
|
414 | 414 | $ hg mv c d |
|
415 | 415 | $ hg unamend |
|
416 | 416 | $ hg st --copies --change . |
|
417 | 417 | A b |
|
418 | 418 | a |
|
419 | 419 | R a |
|
420 | 420 | $ hg st --copies |
|
421 | 421 | A d |
|
422 | 422 | b |
|
423 | 423 | R b |
|
424 | ||
|
425 | Try to unamend a merge | |
|
426 | ||
|
427 | $ cd .. | |
|
428 | $ hg init merge | |
|
429 | $ cd merge | |
|
430 | $ echo initial > initial | |
|
431 | $ hg ci -Aqm initial | |
|
432 | $ echo left > left | |
|
433 | $ hg ci -Aqm left | |
|
434 | $ hg co -q 0 | |
|
435 | $ echo right > right | |
|
436 | $ hg ci -Aqm right | |
|
437 | $ hg merge -q 1 | |
|
438 | $ hg ci -m merge | |
|
439 | $ echo accidental > initial | |
|
440 | $ hg st --rev 1 --rev . | |
|
441 | A right | |
|
442 | $ hg st --rev 2 --rev . | |
|
443 | A left | |
|
444 | $ hg amend | |
|
445 | $ hg unamend | |
|
446 | $ hg st --rev 1 --rev . | |
|
447 | A right | |
|
448 | R left (known-bad-output !) | |
|
449 | $ hg st --rev 2 --rev . | |
|
450 | A left (missing-correct-output !) |
General Comments 0
You need to be logged in to leave comments.
Login now