##// END OF EJS Templates
tests: relax histedit issue4251 and issue3893 backups...
timeless -
r27349:5b68f72c default
parent child Browse files
Show More
@@ -1,447 +1,447
1 1 Test argument handling and various data parsing
2 2 ==================================================
3 3
4 4
5 5 Enable extensions used by this test.
6 6 $ cat >>$HGRCPATH <<EOF
7 7 > [extensions]
8 8 > histedit=
9 9 > EOF
10 10
11 11 Repo setup.
12 12 $ hg init foo
13 13 $ cd foo
14 14 $ echo alpha >> alpha
15 15 $ hg addr
16 16 adding alpha
17 17 $ hg ci -m one
18 18 $ echo alpha >> alpha
19 19 $ hg ci -m two
20 20 $ echo alpha >> alpha
21 21 $ hg ci -m three
22 22 $ echo alpha >> alpha
23 23 $ hg ci -m four
24 24 $ echo alpha >> alpha
25 25 $ hg ci -m five
26 26
27 27 $ hg log --style compact --graph
28 28 @ 4[tip] 08d98a8350f3 1970-01-01 00:00 +0000 test
29 29 | five
30 30 |
31 31 o 3 c8e68270e35a 1970-01-01 00:00 +0000 test
32 32 | four
33 33 |
34 34 o 2 eb57da33312f 1970-01-01 00:00 +0000 test
35 35 | three
36 36 |
37 37 o 1 579e40513370 1970-01-01 00:00 +0000 test
38 38 | two
39 39 |
40 40 o 0 6058cbb6cfd7 1970-01-01 00:00 +0000 test
41 41 one
42 42
43 43
44 44 histedit --continue/--abort with no existing state
45 45 --------------------------------------------------
46 46
47 47 $ hg histedit --continue
48 48 abort: no histedit in progress
49 49 [255]
50 50 $ hg histedit --abort
51 51 abort: no histedit in progress
52 52 [255]
53 53
54 54 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
55 55 --------------------------------------------------------------------
56 56
57 57 $ HGEDITOR=cat hg histedit "tip^^"
58 58 pick eb57da33312f 2 three
59 59 pick c8e68270e35a 3 four
60 60 pick 08d98a8350f3 4 five
61 61
62 62 # Edit history between eb57da33312f and 08d98a8350f3
63 63 #
64 64 # Commits are listed from least to most recent
65 65 #
66 66 # Commands:
67 67 # p, pick = use commit
68 68 # e, edit = use commit, but stop for amending
69 69 # f, fold = use commit, but combine it with the one above
70 70 # r, roll = like fold, but discard this commit's description
71 71 # d, drop = remove commit from history
72 72 # m, mess = edit commit message without changing commit content
73 73 #
74 74 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 75
76 76 Run on a revision not ancestors of the current working directory.
77 77 --------------------------------------------------------------------
78 78
79 79 $ hg up 2
80 80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 81 $ hg histedit -r 4
82 82 abort: 08d98a8350f3 is not an ancestor of working directory
83 83 [255]
84 84 $ hg up --quiet
85 85
86 86
87 87 Test that we pick the minimum of a revrange
88 88 ---------------------------------------
89 89
90 90 $ HGEDITOR=cat hg histedit '2::' --commands - << EOF
91 91 > pick eb57da33312f 2 three
92 92 > pick c8e68270e35a 3 four
93 93 > pick 08d98a8350f3 4 five
94 94 > EOF
95 95 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
96 96 $ hg up --quiet
97 97
98 98 $ HGEDITOR=cat hg histedit 'tip:2' --commands - << EOF
99 99 > pick eb57da33312f 2 three
100 100 > pick c8e68270e35a 3 four
101 101 > pick 08d98a8350f3 4 five
102 102 > EOF
103 103 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
104 104 $ hg up --quiet
105 105
106 106 Test config specified default
107 107 -----------------------------
108 108
109 109 $ HGEDITOR=cat hg histedit --config "histedit.defaultrev=only(.) - ::eb57da33312f" --commands - << EOF
110 110 > pick c8e68270e35a 3 four
111 111 > pick 08d98a8350f3 4 five
112 112 > EOF
113 113 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 114
115 115 Run on a revision not descendants of the initial parent
116 116 --------------------------------------------------------------------
117 117
118 118 Test the message shown for inconsistent histedit state, which may be
119 119 created (and forgotten) by Mercurial earlier than 2.7. This emulates
120 120 Mercurial earlier than 2.7 by renaming ".hg/histedit-state"
121 121 temporarily.
122 122
123 123 $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
124 124 @ 4 08d9 five
125 125 |
126 126 o 3 c8e6 four
127 127 |
128 128 o 2 eb57 three
129 129 |
130 130 $ HGEDITOR=cat hg histedit -r 4 --commands - << EOF
131 131 > edit 08d98a8350f3 4 five
132 132 > EOF
133 133 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
134 134 reverting alpha
135 135 Make changes as needed, you may commit or record as needed now.
136 136 When you are finished, run hg histedit --continue to resume.
137 137 [1]
138 138
139 139 $ mv .hg/histedit-state .hg/histedit-state.back
140 140 $ hg update --quiet --clean 2
141 141 $ echo alpha >> alpha
142 142 $ mv .hg/histedit-state.back .hg/histedit-state
143 143
144 144 $ hg histedit --continue
145 145 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 146 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-backup.hg (glob)
147 147 $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
148 148 @ 4 f5ed five
149 149 |
150 150 | o 3 c8e6 four
151 151 |/
152 152 o 2 eb57 three
153 153 |
154 154
155 155 $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-backup.hg
156 156 $ hg strip -q -r f5ed --config extensions.strip=
157 157 $ hg up -q 08d98a8350f3
158 158
159 159 Test that missing revisions are detected
160 160 ---------------------------------------
161 161
162 162 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
163 163 > pick eb57da33312f 2 three
164 164 > pick 08d98a8350f3 4 five
165 165 > EOF
166 166 abort: missing rules for changeset c8e68270e35a
167 167 (use "drop c8e68270e35a" to discard the change)
168 168 [255]
169 169
170 170 Test that extra revisions are detected
171 171 ---------------------------------------
172 172
173 173 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
174 174 > pick 6058cbb6cfd7 0 one
175 175 > pick c8e68270e35a 3 four
176 176 > pick 08d98a8350f3 4 five
177 177 > EOF
178 178 abort: may not use "pick" with changesets other than the ones listed
179 179 [255]
180 180
181 181 Test malformed line
182 182 ---------------------------------------
183 183
184 184 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
185 185 > pickeb57da33312f2three
186 186 > pick c8e68270e35a 3 four
187 187 > pick 08d98a8350f3 4 five
188 188 > EOF
189 189 abort: malformed line "pickeb57da33312f2three"
190 190 [255]
191 191
192 192 Test unknown changeset
193 193 ---------------------------------------
194 194
195 195 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
196 196 > pick 0123456789ab 2 three
197 197 > pick c8e68270e35a 3 four
198 198 > pick 08d98a8350f3 4 five
199 199 > EOF
200 200 abort: unknown changeset 0123456789ab listed
201 201 [255]
202 202
203 203 Test unknown command
204 204 ---------------------------------------
205 205
206 206 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
207 207 > coin eb57da33312f 2 three
208 208 > pick c8e68270e35a 3 four
209 209 > pick 08d98a8350f3 4 five
210 210 > EOF
211 211 abort: unknown action "coin"
212 212 [255]
213 213
214 214 Test duplicated changeset
215 215 ---------------------------------------
216 216
217 217 So one is missing and one appear twice.
218 218
219 219 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
220 220 > pick eb57da33312f 2 three
221 221 > pick eb57da33312f 2 three
222 222 > pick 08d98a8350f3 4 five
223 223 > EOF
224 224 abort: duplicated command for changeset eb57da33312f
225 225 [255]
226 226
227 227 Test short version of command
228 228 ---------------------------------------
229 229
230 230 Note: we use varying amounts of white space between command name and changeset
231 231 short hash. This tests issue3893.
232 232
233 233 $ HGEDITOR=cat hg histedit "tip^^" --commands - << EOF
234 234 > pick eb57da33312f 2 three
235 235 > p c8e68270e35a 3 four
236 236 > f 08d98a8350f3 4 five
237 237 > EOF
238 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 239 reverting alpha
240 240 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 241 four
242 242 ***
243 243 five
244 244
245 245
246 246
247 247 HG: Enter commit message. Lines beginning with 'HG:' are removed.
248 248 HG: Leave message empty to abort commit.
249 249 HG: --
250 250 HG: user: test
251 251 HG: branch 'default'
252 252 HG: changed alpha
253 253 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 254 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 255 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
256 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-23a13bf9-backup.hg (glob)
256 saved backup bundle to $TESTTMP/foo/.hg/strip-backup/*-backup.hg (glob)
257 257
258 258 $ hg update -q 2
259 259 $ echo x > x
260 260 $ hg add x
261 261 $ hg commit -m'x' x
262 262 created new head
263 263 $ hg histedit -r 'heads(all())'
264 264 abort: The specified revisions must have exactly one common root
265 265 [255]
266 266
267 267 Test that trimming description using multi-byte characters
268 268 --------------------------------------------------------------------
269 269
270 270 $ python <<EOF
271 271 > fp = open('logfile', 'w')
272 272 > fp.write('12345678901234567890123456789012345678901234567890' +
273 273 > '12345') # there are 5 more columns for 80 columns
274 274 >
275 275 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
276 276 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
277 277 >
278 278 > fp.close()
279 279 > EOF
280 280 $ echo xx >> x
281 281 $ hg --encoding utf-8 commit --logfile logfile
282 282
283 283 $ HGEDITOR=cat hg --encoding utf-8 histedit tip
284 284 pick 3d3ea1f3a10b 5 1234567890123456789012345678901234567890123456789012345\xe3\x81\x82... (esc)
285 285
286 286 # Edit history between 3d3ea1f3a10b and 3d3ea1f3a10b
287 287 #
288 288 # Commits are listed from least to most recent
289 289 #
290 290 # Commands:
291 291 # p, pick = use commit
292 292 # e, edit = use commit, but stop for amending
293 293 # f, fold = use commit, but combine it with the one above
294 294 # r, roll = like fold, but discard this commit's description
295 295 # d, drop = remove commit from history
296 296 # m, mess = edit commit message without changing commit content
297 297 #
298 298 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 299
300 300 Test --continue with --keep
301 301
302 302 $ hg strip -q -r . --config extensions.strip=
303 303 $ hg histedit '.^' -q --keep --commands - << EOF
304 304 > edit eb57da33312f 2 three
305 305 > pick f3cfcca30c44 4 x
306 306 > EOF
307 307 Make changes as needed, you may commit or record as needed now.
308 308 When you are finished, run hg histedit --continue to resume.
309 309 [1]
310 310 $ echo edit >> alpha
311 311 $ hg histedit -q --continue
312 312 $ hg log -G -T '{rev}:{node|short} {desc}'
313 313 @ 6:8fda0c726bf2 x
314 314 |
315 315 o 5:63379946892c three
316 316 |
317 317 | o 4:f3cfcca30c44 x
318 318 | |
319 319 | | o 3:2a30f3cfee78 four
320 320 | |/ ***
321 321 | | five
322 322 | o 2:eb57da33312f three
323 323 |/
324 324 o 1:579e40513370 two
325 325 |
326 326 o 0:6058cbb6cfd7 one
327 327
328 328
329 329 Test that abort fails gracefully on exception
330 330 ----------------------------------------------
331 331 $ hg histedit . -q --commands - << EOF
332 332 > edit 8fda0c726bf2 6 x
333 333 > EOF
334 334 Make changes as needed, you may commit or record as needed now.
335 335 When you are finished, run hg histedit --continue to resume.
336 336 [1]
337 337 Corrupt histedit state file
338 338 $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
339 339 $ mv ../corrupt-histedit .hg/histedit-state
340 340 $ hg histedit --abort
341 341 warning: encountered an exception during histedit --abort; the repository may not have been completely cleaned up
342 342 abort: .*(No such file or directory:|The system cannot find the file specified).* (re)
343 343 [255]
344 344 Histedit state has been exited
345 345 $ hg summary -q
346 346 parent: 5:63379946892c
347 347 commit: 1 added, 1 unknown (new branch head)
348 348 update: 4 new changesets (update)
349 349
350 350 $ cd ..
351 351
352 352 Set up default base revision tests
353 353
354 354 $ hg init defaultbase
355 355 $ cd defaultbase
356 356 $ touch foo
357 357 $ hg -q commit -A -m root
358 358 $ echo 1 > foo
359 359 $ hg commit -m 'public 1'
360 360 $ hg phase --force --public -r .
361 361 $ echo 2 > foo
362 362 $ hg commit -m 'draft after public'
363 363 $ hg -q up -r 1
364 364 $ echo 3 > foo
365 365 $ hg commit -m 'head 1 public'
366 366 created new head
367 367 $ hg phase --force --public -r .
368 368 $ echo 4 > foo
369 369 $ hg commit -m 'head 1 draft 1'
370 370 $ echo 5 > foo
371 371 $ hg commit -m 'head 1 draft 2'
372 372 $ hg -q up -r 2
373 373 $ echo 6 > foo
374 374 $ hg commit -m 'head 2 commit 1'
375 375 $ echo 7 > foo
376 376 $ hg commit -m 'head 2 commit 2'
377 377 $ hg -q up -r 2
378 378 $ echo 8 > foo
379 379 $ hg commit -m 'head 3'
380 380 created new head
381 381 $ hg -q up -r 2
382 382 $ echo 9 > foo
383 383 $ hg commit -m 'head 4'
384 384 created new head
385 385 $ hg merge --tool :local -r 8
386 386 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
387 387 (branch merge, don't forget to commit)
388 388 $ hg commit -m 'merge head 3 into head 4'
389 389 $ echo 11 > foo
390 390 $ hg commit -m 'commit 1 after merge'
391 391 $ echo 12 > foo
392 392 $ hg commit -m 'commit 2 after merge'
393 393
394 394 $ hg log -G -T '{rev}:{node|short} {phase} {desc}\n'
395 395 @ 12:8cde254db839 draft commit 2 after merge
396 396 |
397 397 o 11:6f2f0241f119 draft commit 1 after merge
398 398 |
399 399 o 10:90506cc76b00 draft merge head 3 into head 4
400 400 |\
401 401 | o 9:f8607a373a97 draft head 4
402 402 | |
403 403 o | 8:0da92be05148 draft head 3
404 404 |/
405 405 | o 7:4c35cdf97d5e draft head 2 commit 2
406 406 | |
407 407 | o 6:931820154288 draft head 2 commit 1
408 408 |/
409 409 | o 5:8cdc02b9bc63 draft head 1 draft 2
410 410 | |
411 411 | o 4:463b8c0d2973 draft head 1 draft 1
412 412 | |
413 413 | o 3:23a0c4eefcbf public head 1 public
414 414 | |
415 415 o | 2:4117331c3abb draft draft after public
416 416 |/
417 417 o 1:4426d359ea59 public public 1
418 418 |
419 419 o 0:54136a8ddf32 public root
420 420
421 421
422 422 Default base revision should stop at public changesets
423 423
424 424 $ hg -q up 8cdc02b9bc63
425 425 $ hg histedit --commands - <<EOF
426 426 > pick 463b8c0d2973
427 427 > pick 8cdc02b9bc63
428 428 > EOF
429 429 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
430 430
431 431 Default base revision should stop at branchpoint
432 432
433 433 $ hg -q up 4c35cdf97d5e
434 434 $ hg histedit --commands - <<EOF
435 435 > pick 931820154288
436 436 > pick 4c35cdf97d5e
437 437 > EOF
438 438 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
439 439
440 440 Default base revision should stop at merge commit
441 441
442 442 $ hg -q up 8cde254db839
443 443 $ hg histedit --commands - <<EOF
444 444 > pick 6f2f0241f119
445 445 > pick 8cde254db839
446 446 > EOF
447 447 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,460 +1,460
1 1 $ . "$TESTDIR/histedit-helpers.sh"
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [extensions]
5 5 > histedit=
6 6 > EOF
7 7
8 8 $ initrepo ()
9 9 > {
10 10 > hg init r
11 11 > cd r
12 12 > for x in a b c d e f ; do
13 13 > echo $x > $x
14 14 > hg add $x
15 15 > hg ci -m $x
16 16 > done
17 17 > }
18 18
19 19 $ initrepo
20 20
21 21 log before edit
22 22 $ hg log --graph
23 23 @ changeset: 5:652413bf663e
24 24 | tag: tip
25 25 | user: test
26 26 | date: Thu Jan 01 00:00:00 1970 +0000
27 27 | summary: f
28 28 |
29 29 o changeset: 4:e860deea161a
30 30 | user: test
31 31 | date: Thu Jan 01 00:00:00 1970 +0000
32 32 | summary: e
33 33 |
34 34 o changeset: 3:055a42cdd887
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:00 1970 +0000
37 37 | summary: d
38 38 |
39 39 o changeset: 2:177f92b77385
40 40 | user: test
41 41 | date: Thu Jan 01 00:00:00 1970 +0000
42 42 | summary: c
43 43 |
44 44 o changeset: 1:d2ae7f538514
45 45 | user: test
46 46 | date: Thu Jan 01 00:00:00 1970 +0000
47 47 | summary: b
48 48 |
49 49 o changeset: 0:cb9a9f314b8b
50 50 user: test
51 51 date: Thu Jan 01 00:00:00 1970 +0000
52 52 summary: a
53 53
54 54
55 55 show the edit commands offered
56 56 $ HGEDITOR=cat hg histedit 177f92b77385
57 57 pick 177f92b77385 2 c
58 58 pick 055a42cdd887 3 d
59 59 pick e860deea161a 4 e
60 60 pick 652413bf663e 5 f
61 61
62 62 # Edit history between 177f92b77385 and 652413bf663e
63 63 #
64 64 # Commits are listed from least to most recent
65 65 #
66 66 # Commands:
67 67 # p, pick = use commit
68 68 # e, edit = use commit, but stop for amending
69 69 # f, fold = use commit, but combine it with the one above
70 70 # r, roll = like fold, but discard this commit's description
71 71 # d, drop = remove commit from history
72 72 # m, mess = edit commit message without changing commit content
73 73 #
74 74 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 75
76 76 edit the history
77 77 (use a hacky editor to check histedit-last-edit.txt backup)
78 78
79 79 $ EDITED="$TESTTMP/editedhistory"
80 80 $ cat > $EDITED <<EOF
81 81 > pick 177f92b77385 c
82 82 > pick e860deea161a e
83 83 > pick 652413bf663e f
84 84 > pick 055a42cdd887 d
85 85 > EOF
86 86 $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
87 87 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
88 88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 90 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91
92 92 rules should end up in .hg/histedit-last-edit.txt:
93 93 $ cat .hg/histedit-last-edit.txt
94 94 pick 177f92b77385 c
95 95 pick e860deea161a e
96 96 pick 652413bf663e f
97 97 pick 055a42cdd887 d
98 98
99 99 log after edit
100 100 $ hg log --graph
101 101 @ changeset: 5:07114f51870f
102 102 | tag: tip
103 103 | user: test
104 104 | date: Thu Jan 01 00:00:00 1970 +0000
105 105 | summary: d
106 106 |
107 107 o changeset: 4:8ade9693061e
108 108 | user: test
109 109 | date: Thu Jan 01 00:00:00 1970 +0000
110 110 | summary: f
111 111 |
112 112 o changeset: 3:d8249471110a
113 113 | user: test
114 114 | date: Thu Jan 01 00:00:00 1970 +0000
115 115 | summary: e
116 116 |
117 117 o changeset: 2:177f92b77385
118 118 | user: test
119 119 | date: Thu Jan 01 00:00:00 1970 +0000
120 120 | summary: c
121 121 |
122 122 o changeset: 1:d2ae7f538514
123 123 | user: test
124 124 | date: Thu Jan 01 00:00:00 1970 +0000
125 125 | summary: b
126 126 |
127 127 o changeset: 0:cb9a9f314b8b
128 128 user: test
129 129 date: Thu Jan 01 00:00:00 1970 +0000
130 130 summary: a
131 131
132 132
133 133 put things back
134 134
135 135 $ hg histedit 177f92b77385 --commands - 2>&1 << EOF | fixbundle
136 136 > pick 177f92b77385 c
137 137 > pick 07114f51870f d
138 138 > pick d8249471110a e
139 139 > pick 8ade9693061e f
140 140 > EOF
141 141 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
142 142 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 143 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
144 144 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
145 145
146 146 $ hg log --graph
147 147 @ changeset: 5:7eca9b5b1148
148 148 | tag: tip
149 149 | user: test
150 150 | date: Thu Jan 01 00:00:00 1970 +0000
151 151 | summary: f
152 152 |
153 153 o changeset: 4:915da888f2de
154 154 | user: test
155 155 | date: Thu Jan 01 00:00:00 1970 +0000
156 156 | summary: e
157 157 |
158 158 o changeset: 3:10517e47bbbb
159 159 | user: test
160 160 | date: Thu Jan 01 00:00:00 1970 +0000
161 161 | summary: d
162 162 |
163 163 o changeset: 2:177f92b77385
164 164 | user: test
165 165 | date: Thu Jan 01 00:00:00 1970 +0000
166 166 | summary: c
167 167 |
168 168 o changeset: 1:d2ae7f538514
169 169 | user: test
170 170 | date: Thu Jan 01 00:00:00 1970 +0000
171 171 | summary: b
172 172 |
173 173 o changeset: 0:cb9a9f314b8b
174 174 user: test
175 175 date: Thu Jan 01 00:00:00 1970 +0000
176 176 summary: a
177 177
178 178
179 179 slightly different this time
180 180
181 181 $ hg histedit 177f92b77385 --commands - << EOF 2>&1 | fixbundle
182 182 > pick 10517e47bbbb d
183 183 > pick 7eca9b5b1148 f
184 184 > pick 915da888f2de e
185 185 > pick 177f92b77385 c
186 186 > EOF
187 187 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
188 188 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 189 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 190 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 191 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 192 $ hg log --graph
193 193 @ changeset: 5:38b92f448761
194 194 | tag: tip
195 195 | user: test
196 196 | date: Thu Jan 01 00:00:00 1970 +0000
197 197 | summary: c
198 198 |
199 199 o changeset: 4:de71b079d9ce
200 200 | user: test
201 201 | date: Thu Jan 01 00:00:00 1970 +0000
202 202 | summary: e
203 203 |
204 204 o changeset: 3:be9ae3a309c6
205 205 | user: test
206 206 | date: Thu Jan 01 00:00:00 1970 +0000
207 207 | summary: f
208 208 |
209 209 o changeset: 2:799205341b6b
210 210 | user: test
211 211 | date: Thu Jan 01 00:00:00 1970 +0000
212 212 | summary: d
213 213 |
214 214 o changeset: 1:d2ae7f538514
215 215 | user: test
216 216 | date: Thu Jan 01 00:00:00 1970 +0000
217 217 | summary: b
218 218 |
219 219 o changeset: 0:cb9a9f314b8b
220 220 user: test
221 221 date: Thu Jan 01 00:00:00 1970 +0000
222 222 summary: a
223 223
224 224
225 225 keep prevents stripping dead revs
226 226 $ hg histedit 799205341b6b --keep --commands - 2>&1 << EOF | fixbundle
227 227 > pick 799205341b6b d
228 228 > pick be9ae3a309c6 f
229 229 > pick 38b92f448761 c
230 230 > pick de71b079d9ce e
231 231 > EOF
232 232 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
233 233 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
234 234 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 235 $ hg log --graph
236 236 @ changeset: 7:803ef1c6fcfd
237 237 | tag: tip
238 238 | user: test
239 239 | date: Thu Jan 01 00:00:00 1970 +0000
240 240 | summary: e
241 241 |
242 242 o changeset: 6:ece0b8d93dda
243 243 | parent: 3:be9ae3a309c6
244 244 | user: test
245 245 | date: Thu Jan 01 00:00:00 1970 +0000
246 246 | summary: c
247 247 |
248 248 | o changeset: 5:38b92f448761
249 249 | | user: test
250 250 | | date: Thu Jan 01 00:00:00 1970 +0000
251 251 | | summary: c
252 252 | |
253 253 | o changeset: 4:de71b079d9ce
254 254 |/ user: test
255 255 | date: Thu Jan 01 00:00:00 1970 +0000
256 256 | summary: e
257 257 |
258 258 o changeset: 3:be9ae3a309c6
259 259 | user: test
260 260 | date: Thu Jan 01 00:00:00 1970 +0000
261 261 | summary: f
262 262 |
263 263 o changeset: 2:799205341b6b
264 264 | user: test
265 265 | date: Thu Jan 01 00:00:00 1970 +0000
266 266 | summary: d
267 267 |
268 268 o changeset: 1:d2ae7f538514
269 269 | user: test
270 270 | date: Thu Jan 01 00:00:00 1970 +0000
271 271 | summary: b
272 272 |
273 273 o changeset: 0:cb9a9f314b8b
274 274 user: test
275 275 date: Thu Jan 01 00:00:00 1970 +0000
276 276 summary: a
277 277
278 278
279 279 try with --rev
280 280 $ hg histedit --commands - --rev -2 2>&1 <<EOF | fixbundle
281 281 > pick de71b079d9ce e
282 282 > pick 38b92f448761 c
283 283 > EOF
284 284 abort: may not use "pick" with changesets other than the ones listed
285 285 $ hg log --graph
286 286 @ changeset: 7:803ef1c6fcfd
287 287 | tag: tip
288 288 | user: test
289 289 | date: Thu Jan 01 00:00:00 1970 +0000
290 290 | summary: e
291 291 |
292 292 o changeset: 6:ece0b8d93dda
293 293 | parent: 3:be9ae3a309c6
294 294 | user: test
295 295 | date: Thu Jan 01 00:00:00 1970 +0000
296 296 | summary: c
297 297 |
298 298 | o changeset: 5:38b92f448761
299 299 | | user: test
300 300 | | date: Thu Jan 01 00:00:00 1970 +0000
301 301 | | summary: c
302 302 | |
303 303 | o changeset: 4:de71b079d9ce
304 304 |/ user: test
305 305 | date: Thu Jan 01 00:00:00 1970 +0000
306 306 | summary: e
307 307 |
308 308 o changeset: 3:be9ae3a309c6
309 309 | user: test
310 310 | date: Thu Jan 01 00:00:00 1970 +0000
311 311 | summary: f
312 312 |
313 313 o changeset: 2:799205341b6b
314 314 | user: test
315 315 | date: Thu Jan 01 00:00:00 1970 +0000
316 316 | summary: d
317 317 |
318 318 o changeset: 1:d2ae7f538514
319 319 | user: test
320 320 | date: Thu Jan 01 00:00:00 1970 +0000
321 321 | summary: b
322 322 |
323 323 o changeset: 0:cb9a9f314b8b
324 324 user: test
325 325 date: Thu Jan 01 00:00:00 1970 +0000
326 326 summary: a
327 327
328 328 Verify that revsetalias entries work with histedit:
329 329 $ cat >> $HGRCPATH <<EOF
330 330 > [revsetalias]
331 331 > grandparent(ARG) = p1(p1(ARG))
332 332 > EOF
333 333 $ echo extra commit >> c
334 334 $ hg ci -m 'extra commit to c'
335 335 $ HGEDITOR=cat hg histedit 'grandparent(.)'
336 336 pick ece0b8d93dda 6 c
337 337 pick 803ef1c6fcfd 7 e
338 338 pick 9c863c565126 8 extra commit to c
339 339
340 340 # Edit history between ece0b8d93dda and 9c863c565126
341 341 #
342 342 # Commits are listed from least to most recent
343 343 #
344 344 # Commands:
345 345 # p, pick = use commit
346 346 # e, edit = use commit, but stop for amending
347 347 # f, fold = use commit, but combine it with the one above
348 348 # r, roll = like fold, but discard this commit's description
349 349 # d, drop = remove commit from history
350 350 # m, mess = edit commit message without changing commit content
351 351 #
352 352 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 353
354 354 should also work if a commit message is missing
355 355 $ BUNDLE="$TESTDIR/missing-comment.hg"
356 356 $ hg init missing
357 357 $ cd missing
358 358 $ hg unbundle $BUNDLE
359 359 adding changesets
360 360 adding manifests
361 361 adding file changes
362 362 added 3 changesets with 3 changes to 1 files
363 363 (run 'hg update' to get a working copy)
364 364 $ hg co tip
365 365 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
366 366 $ hg log --graph
367 367 @ changeset: 2:bd22688093b3
368 368 | tag: tip
369 369 | user: Robert Altman <robert.altman@telventDTN.com>
370 370 | date: Mon Nov 28 16:40:04 2011 +0000
371 371 | summary: Update file.
372 372 |
373 373 o changeset: 1:3b3e956f9171
374 374 | user: Robert Altman <robert.altman@telventDTN.com>
375 375 | date: Mon Nov 28 16:37:57 2011 +0000
376 376 |
377 377 o changeset: 0:141947992243
378 378 user: Robert Altman <robert.altman@telventDTN.com>
379 379 date: Mon Nov 28 16:35:28 2011 +0000
380 380 summary: Checked in text file
381 381
382 382 $ hg histedit 0
383 383 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
384 384 $ cd ..
385 385
386 386 $ cd ..
387 387
388 388
389 389 Test to make sure folding renames doesn't cause bogus conflicts (issue4251):
390 390 $ hg init issue4251
391 391 $ cd issue4251
392 392
393 393 $ mkdir initial-dir
394 394 $ echo foo > initial-dir/initial-file
395 395 $ hg add initial-dir/initial-file
396 396 $ hg commit -m "initial commit"
397 397
398 398 Move the file to a new directory, and in the same commit, change its content:
399 399 $ mkdir another-dir
400 400 $ hg mv initial-dir/initial-file another-dir/
401 401 $ echo changed > another-dir/initial-file
402 402 $ hg commit -m "moved and changed"
403 403
404 404 Rename the file:
405 405 $ hg mv another-dir/initial-file another-dir/renamed-file
406 406 $ hg commit -m "renamed"
407 407
408 408 Now, let's try to fold the second commit into the first:
409 409 $ cat > editor.sh <<EOF
410 410 > #!/bin/sh
411 411 > cat > \$1 <<ENDOF
412 412 > pick b0f4233702ca 0 initial commit
413 413 > fold 5e8704a8f2d2 1 moved and changed
414 414 > pick 40e7299e8fa7 2 renamed
415 415 > ENDOF
416 416 > EOF
417 417
418 418 $ HGEDITOR="sh ./editor.sh" hg histedit 0
419 419 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
420 420 adding another-dir/initial-file (glob)
421 421 removing initial-dir/initial-file (glob)
422 422 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
423 423 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
424 424 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 425 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
426 426 saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
427 saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/b0f4233702ca-d99e7186-backup.hg (glob)
427 saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/*-backup.hg (glob)
428 428
429 429 $ hg --config diff.git=yes export 0
430 430 # HG changeset patch
431 431 # User test
432 432 # Date 0 0
433 433 # Thu Jan 01 00:00:00 1970 +0000
434 434 # Node ID fffadc26f8f85623ce60b028a3f1ccc3730f8530
435 435 # Parent 0000000000000000000000000000000000000000
436 436 pick b0f4233702ca 0 initial commit
437 437 fold 5e8704a8f2d2 1 moved and changed
438 438 pick 40e7299e8fa7 2 renamed
439 439
440 440 diff --git a/another-dir/initial-file b/another-dir/initial-file
441 441 new file mode 100644
442 442 --- /dev/null
443 443 +++ b/another-dir/initial-file
444 444 @@ -0,0 +1,1 @@
445 445 +changed
446 446
447 447 $ hg --config diff.git=yes export 1
448 448 # HG changeset patch
449 449 # User test
450 450 # Date 0 0
451 451 # Thu Jan 01 00:00:00 1970 +0000
452 452 # Node ID 9b730d82b00af8a2766facebfa47cc124405a118
453 453 # Parent fffadc26f8f85623ce60b028a3f1ccc3730f8530
454 454 renamed
455 455
456 456 diff --git a/another-dir/initial-file b/another-dir/renamed-file
457 457 rename from another-dir/initial-file
458 458 rename to another-dir/renamed-file
459 459
460 460 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now