##// END OF EJS Templates
tests: write hgrc of more than two lines by using shell heredoc...
Yuya Nishihara -
r23172:e955549c default
parent child Browse files
Show More
@@ -1,35 +1,37 b''
1 1 $ cat > abortcommit.py <<EOF
2 2 > from mercurial import util
3 3 > def hook(**args):
4 4 > raise util.Abort("no commits allowed")
5 5 > def reposetup(ui, repo):
6 6 > repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook)
7 7 > EOF
8 8 $ abspath=`pwd`/abortcommit.py
9 9
10 $ echo "[extensions]" >> $HGRCPATH
11 $ echo "mq=" >> $HGRCPATH
12 $ echo "abortcommit = $abspath" >> $HGRCPATH
10 $ cat <<EOF >> $HGRCPATH
11 > [extensions]
12 > mq =
13 > abortcommit = $abspath
14 > EOF
13 15
14 16 $ hg init foo
15 17 $ cd foo
16 18 $ echo foo > foo
17 19 $ hg add foo
18 20
19 21 mq may keep a reference to the repository so __del__ will not be
20 22 called and .hg/journal.dirstate will not be deleted:
21 23
22 24 $ hg ci -m foo
23 25 error: pretxncommit.nocommits hook failed: no commits allowed
24 26 transaction abort!
25 27 rollback completed
26 28 abort: no commits allowed
27 29 [255]
28 30 $ hg ci -m foo
29 31 error: pretxncommit.nocommits hook failed: no commits allowed
30 32 transaction abort!
31 33 rollback completed
32 34 abort: no commits allowed
33 35 [255]
34 36
35 37 $ cd ..
@@ -1,15 +1,17 b''
1 1 $ echo 'raise Exception("bit bucket overflow")' > badext.py
2 2 $ abspath=`pwd`/badext.py
3 3
4 $ echo '[extensions]' >> $HGRCPATH
5 $ echo "gpg =" >> $HGRCPATH
6 $ echo "hgext.gpg =" >> $HGRCPATH
7 $ echo "badext = $abspath" >> $HGRCPATH
8 $ echo "badext2 =" >> $HGRCPATH
4 $ cat <<EOF >> $HGRCPATH
5 > [extensions]
6 > gpg =
7 > hgext.gpg =
8 > badext = $abspath
9 > badext2 =
10 > EOF
9 11
10 12 $ hg -q help help
11 13 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
12 14 *** failed to import extension badext2: No module named badext2
13 15 hg help [-ec] [TOPIC]
14 16
15 17 show help for a given topic or a help overview
@@ -1,519 +1,523 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo 'root' >root
4 4 $ hg add root
5 5 $ hg commit -d '0 0' -m "Adding root node"
6 6
7 7 $ echo 'a' >a
8 8 $ hg add a
9 9 $ hg branch a
10 10 marked working directory as branch a
11 11 (branches are permanent and global, did you want a bookmark?)
12 12 $ hg commit -d '1 0' -m "Adding a branch"
13 13
14 14 $ hg branch q
15 15 marked working directory as branch q
16 16 (branches are permanent and global, did you want a bookmark?)
17 17 $ echo 'aa' >a
18 18 $ hg branch -C
19 19 reset working directory to branch a
20 20 $ hg commit -d '2 0' -m "Adding to a branch"
21 21
22 22 $ hg update -C 0
23 23 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
24 24 $ echo 'b' >b
25 25 $ hg add b
26 26 $ hg branch b
27 27 marked working directory as branch b
28 28 (branches are permanent and global, did you want a bookmark?)
29 29 $ hg commit -d '2 0' -m "Adding b branch"
30 30
31 31 $ echo 'bh1' >bh1
32 32 $ hg add bh1
33 33 $ hg commit -d '3 0' -m "Adding b branch head 1"
34 34
35 35 $ hg update -C 2
36 36 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
37 37 $ echo 'bh2' >bh2
38 38 $ hg add bh2
39 39 $ hg commit -d '4 0' -m "Adding b branch head 2"
40 40
41 41 $ echo 'c' >c
42 42 $ hg add c
43 43 $ hg branch c
44 44 marked working directory as branch c
45 45 (branches are permanent and global, did you want a bookmark?)
46 46 $ hg commit -d '5 0' -m "Adding c branch"
47 47
48 48 reserved names
49 49
50 50 $ hg branch tip
51 51 abort: the name 'tip' is reserved
52 52 [255]
53 53 $ hg branch null
54 54 abort: the name 'null' is reserved
55 55 [255]
56 56 $ hg branch .
57 57 abort: the name '.' is reserved
58 58 [255]
59 59
60 60 invalid characters
61 61
62 62 $ hg branch 'foo:bar'
63 63 abort: ':' cannot be used in a name
64 64 [255]
65 65
66 66 $ hg branch 'foo
67 67 > bar'
68 68 abort: '\n' cannot be used in a name
69 69 [255]
70 70
71 71 trailing or leading spaces should be stripped before testing duplicates
72 72
73 73 $ hg branch 'b '
74 74 abort: a branch of the same name already exists
75 75 (use 'hg update' to switch to it)
76 76 [255]
77 77
78 78 $ hg branch ' b'
79 79 abort: a branch of the same name already exists
80 80 (use 'hg update' to switch to it)
81 81 [255]
82 82
83 83 verify update will accept invalid legacy branch names
84 84
85 85 $ hg init test-invalid-branch-name
86 86 $ cd test-invalid-branch-name
87 87 $ hg pull -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
88 88 pulling from *test-invalid-branch-name.hg (glob)
89 89 requesting all changes
90 90 adding changesets
91 91 adding manifests
92 92 adding file changes
93 93 added 3 changesets with 3 changes to 2 files
94 94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 95
96 96 $ hg update '"colon:test"'
97 97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 98 $ cd ..
99 99
100 100 $ echo 'd' >d
101 101 $ hg add d
102 102 $ hg branch 'a branch name much longer than the default justification used by branches'
103 103 marked working directory as branch a branch name much longer than the default justification used by branches
104 104 (branches are permanent and global, did you want a bookmark?)
105 105 $ hg commit -d '6 0' -m "Adding d branch"
106 106
107 107 $ hg branches
108 108 a branch name much longer than the default justification used by branches 7:10ff5895aa57
109 109 b 4:aee39cd168d0
110 110 c 6:589736a22561 (inactive)
111 111 a 5:d8cbc61dbaa6 (inactive)
112 112 default 0:19709c5a4e75 (inactive)
113 113
114 114 -------
115 115
116 116 $ hg branches -a
117 117 a branch name much longer than the default justification used by branches 7:10ff5895aa57
118 118 b 4:aee39cd168d0
119 119
120 120 --- Branch a
121 121
122 122 $ hg log -b a
123 123 changeset: 5:d8cbc61dbaa6
124 124 branch: a
125 125 parent: 2:881fe2b92ad0
126 126 user: test
127 127 date: Thu Jan 01 00:00:04 1970 +0000
128 128 summary: Adding b branch head 2
129 129
130 130 changeset: 2:881fe2b92ad0
131 131 branch: a
132 132 user: test
133 133 date: Thu Jan 01 00:00:02 1970 +0000
134 134 summary: Adding to a branch
135 135
136 136 changeset: 1:dd6b440dd85a
137 137 branch: a
138 138 user: test
139 139 date: Thu Jan 01 00:00:01 1970 +0000
140 140 summary: Adding a branch
141 141
142 142
143 143 ---- Branch b
144 144
145 145 $ hg log -b b
146 146 changeset: 4:aee39cd168d0
147 147 branch: b
148 148 user: test
149 149 date: Thu Jan 01 00:00:03 1970 +0000
150 150 summary: Adding b branch head 1
151 151
152 152 changeset: 3:ac22033332d1
153 153 branch: b
154 154 parent: 0:19709c5a4e75
155 155 user: test
156 156 date: Thu Jan 01 00:00:02 1970 +0000
157 157 summary: Adding b branch
158 158
159 159
160 160 ---- going to test branch closing
161 161
162 162 $ hg branches
163 163 a branch name much longer than the default justification used by branches 7:10ff5895aa57
164 164 b 4:aee39cd168d0
165 165 c 6:589736a22561 (inactive)
166 166 a 5:d8cbc61dbaa6 (inactive)
167 167 default 0:19709c5a4e75 (inactive)
168 168 $ hg up -C b
169 169 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
170 170 $ echo 'xxx1' >> b
171 171 $ hg commit -d '7 0' -m 'adding cset to branch b'
172 172 $ hg up -C aee39cd168d0
173 173 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 174 $ echo 'xxx2' >> b
175 175 $ hg commit -d '8 0' -m 'adding head to branch b'
176 176 created new head
177 177 $ echo 'xxx3' >> b
178 178 $ hg commit -d '9 0' -m 'adding another cset to branch b'
179 179 $ hg branches
180 180 b 10:bfbe841b666e
181 181 a branch name much longer than the default justification used by branches 7:10ff5895aa57
182 182 c 6:589736a22561 (inactive)
183 183 a 5:d8cbc61dbaa6 (inactive)
184 184 default 0:19709c5a4e75 (inactive)
185 185 $ hg heads --closed
186 186 changeset: 10:bfbe841b666e
187 187 branch: b
188 188 tag: tip
189 189 user: test
190 190 date: Thu Jan 01 00:00:09 1970 +0000
191 191 summary: adding another cset to branch b
192 192
193 193 changeset: 8:eebb944467c9
194 194 branch: b
195 195 parent: 4:aee39cd168d0
196 196 user: test
197 197 date: Thu Jan 01 00:00:07 1970 +0000
198 198 summary: adding cset to branch b
199 199
200 200 changeset: 7:10ff5895aa57
201 201 branch: a branch name much longer than the default justification used by branches
202 202 user: test
203 203 date: Thu Jan 01 00:00:06 1970 +0000
204 204 summary: Adding d branch
205 205
206 206 changeset: 6:589736a22561
207 207 branch: c
208 208 user: test
209 209 date: Thu Jan 01 00:00:05 1970 +0000
210 210 summary: Adding c branch
211 211
212 212 changeset: 5:d8cbc61dbaa6
213 213 branch: a
214 214 parent: 2:881fe2b92ad0
215 215 user: test
216 216 date: Thu Jan 01 00:00:04 1970 +0000
217 217 summary: Adding b branch head 2
218 218
219 219 changeset: 0:19709c5a4e75
220 220 user: test
221 221 date: Thu Jan 01 00:00:00 1970 +0000
222 222 summary: Adding root node
223 223
224 224 $ hg heads
225 225 changeset: 10:bfbe841b666e
226 226 branch: b
227 227 tag: tip
228 228 user: test
229 229 date: Thu Jan 01 00:00:09 1970 +0000
230 230 summary: adding another cset to branch b
231 231
232 232 changeset: 8:eebb944467c9
233 233 branch: b
234 234 parent: 4:aee39cd168d0
235 235 user: test
236 236 date: Thu Jan 01 00:00:07 1970 +0000
237 237 summary: adding cset to branch b
238 238
239 239 changeset: 7:10ff5895aa57
240 240 branch: a branch name much longer than the default justification used by branches
241 241 user: test
242 242 date: Thu Jan 01 00:00:06 1970 +0000
243 243 summary: Adding d branch
244 244
245 245 changeset: 6:589736a22561
246 246 branch: c
247 247 user: test
248 248 date: Thu Jan 01 00:00:05 1970 +0000
249 249 summary: Adding c branch
250 250
251 251 changeset: 5:d8cbc61dbaa6
252 252 branch: a
253 253 parent: 2:881fe2b92ad0
254 254 user: test
255 255 date: Thu Jan 01 00:00:04 1970 +0000
256 256 summary: Adding b branch head 2
257 257
258 258 changeset: 0:19709c5a4e75
259 259 user: test
260 260 date: Thu Jan 01 00:00:00 1970 +0000
261 261 summary: Adding root node
262 262
263 263 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
264 264 $ hg branches -a
265 265 b 8:eebb944467c9
266 266 a branch name much longer than the default justification used by branches 7:10ff5895aa57
267 267 $ hg up -C b
268 268 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 269 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
270 270 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
271 271 abort: can only close branch heads
272 272 [255]
273 273
274 274 $ hg log -r tip --debug
275 275 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
276 276 branch: b
277 277 tag: tip
278 278 phase: draft
279 279 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
280 280 parent: -1:0000000000000000000000000000000000000000
281 281 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
282 282 user: test
283 283 date: Thu Jan 01 00:00:09 1970 +0000
284 284 extra: branch=b
285 285 extra: close=1
286 286 description:
287 287 close this part branch too
288 288
289 289
290 290 --- b branch should be inactive
291 291
292 292 $ hg branches
293 293 a branch name much longer than the default justification used by branches 7:10ff5895aa57
294 294 c 6:589736a22561 (inactive)
295 295 a 5:d8cbc61dbaa6 (inactive)
296 296 default 0:19709c5a4e75 (inactive)
297 297 $ hg branches -c
298 298 a branch name much longer than the default justification used by branches 7:10ff5895aa57
299 299 b 12:e3d49c0575d8 (closed)
300 300 c 6:589736a22561 (inactive)
301 301 a 5:d8cbc61dbaa6 (inactive)
302 302 default 0:19709c5a4e75 (inactive)
303 303 $ hg branches -a
304 304 a branch name much longer than the default justification used by branches 7:10ff5895aa57
305 305 $ hg branches -q
306 306 a branch name much longer than the default justification used by branches
307 307 c
308 308 a
309 309 default
310 310 $ hg heads b
311 311 no open branch heads found on branches b
312 312 [1]
313 313 $ hg heads --closed b
314 314 changeset: 12:e3d49c0575d8
315 315 branch: b
316 316 tag: tip
317 317 parent: 8:eebb944467c9
318 318 user: test
319 319 date: Thu Jan 01 00:00:09 1970 +0000
320 320 summary: close this part branch too
321 321
322 322 changeset: 11:d3f163457ebf
323 323 branch: b
324 324 user: test
325 325 date: Thu Jan 01 00:00:09 1970 +0000
326 326 summary: prune bad branch
327 327
328 328 $ echo 'xxx4' >> b
329 329 $ hg commit -d '9 0' -m 'reopen branch with a change'
330 330 reopening closed branch head 12
331 331
332 332 --- branch b is back in action
333 333
334 334 $ hg branches -a
335 335 b 13:e23b5505d1ad
336 336 a branch name much longer than the default justification used by branches 7:10ff5895aa57
337 337
338 338 ---- test heads listings
339 339
340 340 $ hg heads
341 341 changeset: 13:e23b5505d1ad
342 342 branch: b
343 343 tag: tip
344 344 user: test
345 345 date: Thu Jan 01 00:00:09 1970 +0000
346 346 summary: reopen branch with a change
347 347
348 348 changeset: 7:10ff5895aa57
349 349 branch: a branch name much longer than the default justification used by branches
350 350 user: test
351 351 date: Thu Jan 01 00:00:06 1970 +0000
352 352 summary: Adding d branch
353 353
354 354 changeset: 6:589736a22561
355 355 branch: c
356 356 user: test
357 357 date: Thu Jan 01 00:00:05 1970 +0000
358 358 summary: Adding c branch
359 359
360 360 changeset: 5:d8cbc61dbaa6
361 361 branch: a
362 362 parent: 2:881fe2b92ad0
363 363 user: test
364 364 date: Thu Jan 01 00:00:04 1970 +0000
365 365 summary: Adding b branch head 2
366 366
367 367 changeset: 0:19709c5a4e75
368 368 user: test
369 369 date: Thu Jan 01 00:00:00 1970 +0000
370 370 summary: Adding root node
371 371
372 372
373 373 branch default
374 374
375 375 $ hg heads default
376 376 changeset: 0:19709c5a4e75
377 377 user: test
378 378 date: Thu Jan 01 00:00:00 1970 +0000
379 379 summary: Adding root node
380 380
381 381
382 382 branch a
383 383
384 384 $ hg heads a
385 385 changeset: 5:d8cbc61dbaa6
386 386 branch: a
387 387 parent: 2:881fe2b92ad0
388 388 user: test
389 389 date: Thu Jan 01 00:00:04 1970 +0000
390 390 summary: Adding b branch head 2
391 391
392 392 $ hg heads --active a
393 393 no open branch heads found on branches a
394 394 [1]
395 395
396 396 branch b
397 397
398 398 $ hg heads b
399 399 changeset: 13:e23b5505d1ad
400 400 branch: b
401 401 tag: tip
402 402 user: test
403 403 date: Thu Jan 01 00:00:09 1970 +0000
404 404 summary: reopen branch with a change
405 405
406 406 $ hg heads --closed b
407 407 changeset: 13:e23b5505d1ad
408 408 branch: b
409 409 tag: tip
410 410 user: test
411 411 date: Thu Jan 01 00:00:09 1970 +0000
412 412 summary: reopen branch with a change
413 413
414 414 changeset: 11:d3f163457ebf
415 415 branch: b
416 416 user: test
417 417 date: Thu Jan 01 00:00:09 1970 +0000
418 418 summary: prune bad branch
419 419
420 420 default branch colors:
421 421
422 $ echo "[extensions]" >> $HGRCPATH
423 $ echo "color =" >> $HGRCPATH
424 $ echo "[color]" >> $HGRCPATH
425 $ echo "mode = ansi" >> $HGRCPATH
422 $ cat <<EOF >> $HGRCPATH
423 > [extensions]
424 > color =
425 > [color]
426 > mode = ansi
427 > EOF
426 428
427 429 $ hg up -C c
428 430 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
429 431 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
430 432 $ hg up -C b
431 433 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
432 434 $ hg branches --color=always
433 435 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
434 436 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
435 437 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
436 438 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
437 439
438 440 default closed branch color:
439 441
440 442 $ hg branches --color=always --closed
441 443 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
442 444 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
443 445 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
444 446 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
445 447 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
446 448
447 $ echo "[extensions]" >> $HGRCPATH
448 $ echo "color =" >> $HGRCPATH
449 $ echo "[color]" >> $HGRCPATH
450 $ echo "branches.active = green" >> $HGRCPATH
451 $ echo "branches.closed = blue" >> $HGRCPATH
452 $ echo "branches.current = red" >> $HGRCPATH
453 $ echo "branches.inactive = magenta" >> $HGRCPATH
454 $ echo "log.changeset = cyan" >> $HGRCPATH
449 $ cat <<EOF >> $HGRCPATH
450 > [extensions]
451 > color =
452 > [color]
453 > branches.active = green
454 > branches.closed = blue
455 > branches.current = red
456 > branches.inactive = magenta
457 > log.changeset = cyan
458 > EOF
455 459
456 460 custom branch colors:
457 461
458 462 $ hg branches --color=always
459 463 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
460 464 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
461 465 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
462 466 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
463 467
464 468 custom closed branch color:
465 469
466 470 $ hg branches --color=always --closed
467 471 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
468 472 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
469 473 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
470 474 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
471 475 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
472 476
473 477 template output:
474 478
475 479 $ hg branches -Tjson --closed
476 480 [
477 481 {
478 482 "active": true,
479 483 "branch": "b",
480 484 "closed": false,
481 485 "current": true,
482 486 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
483 487 "rev": 13
484 488 },
485 489 {
486 490 "active": true,
487 491 "branch": "a branch name much longer than the default justification used by branches",
488 492 "closed": false,
489 493 "current": false,
490 494 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
491 495 "rev": 7
492 496 },
493 497 {
494 498 "active": false,
495 499 "branch": "c",
496 500 "closed": true,
497 501 "current": false,
498 502 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
499 503 "rev": 14
500 504 },
501 505 {
502 506 "active": false,
503 507 "branch": "a",
504 508 "closed": false,
505 509 "current": false,
506 510 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
507 511 "rev": 5
508 512 },
509 513 {
510 514 "active": false,
511 515 "branch": "default",
512 516 "closed": false,
513 517 "current": false,
514 518 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
515 519 "rev": 0
516 520 }
517 521 ]
518 522
519 523 $ cd ..
@@ -1,90 +1,92 b''
1 1 hide outer repo
2 2 $ hg init
3 3
4 4 Invalid syntax: no value
5 5
6 6 $ cat > .hg/hgrc << EOF
7 7 > novaluekey
8 8 > EOF
9 9 $ hg showconfig
10 10 hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey
11 11 [255]
12 12
13 13 Invalid syntax: no key
14 14
15 15 $ cat > .hg/hgrc << EOF
16 16 > =nokeyvalue
17 17 > EOF
18 18 $ hg showconfig
19 19 hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
20 20 [255]
21 21
22 22 Test hint about invalid syntax from leading white space
23 23
24 24 $ cat > .hg/hgrc << EOF
25 25 > key=value
26 26 > EOF
27 27 $ hg showconfig
28 28 hg: parse error at $TESTTMP/.hg/hgrc:1: key=value
29 29 unexpected leading whitespace
30 30 [255]
31 31
32 32 $ cat > .hg/hgrc << EOF
33 33 > [section]
34 34 > key=value
35 35 > EOF
36 36 $ hg showconfig
37 37 hg: parse error at $TESTTMP/.hg/hgrc:1: [section]
38 38 unexpected leading whitespace
39 39 [255]
40 40
41 41 Reset hgrc
42 42
43 43 $ echo > .hg/hgrc
44 44
45 45 Test case sensitive configuration
46 46
47 $ echo '[Section]' >> $HGRCPATH
48 $ echo 'KeY = Case Sensitive' >> $HGRCPATH
49 $ echo 'key = lower case' >> $HGRCPATH
47 $ cat <<EOF >> $HGRCPATH
48 > [Section]
49 > KeY = Case Sensitive
50 > key = lower case
51 > EOF
50 52
51 53 $ hg showconfig Section
52 54 Section.KeY=Case Sensitive
53 55 Section.key=lower case
54 56
55 57 Test "%unset"
56 58
57 59 $ cat >> $HGRCPATH <<EOF
58 60 > [unsettest]
59 61 > local-hgrcpath = should be unset (HGRCPATH)
60 62 > %unset local-hgrcpath
61 63 >
62 64 > global = should be unset (HGRCPATH)
63 65 >
64 66 > both = should be unset (HGRCPATH)
65 67 >
66 68 > set-after-unset = should be unset (HGRCPATH)
67 69 > EOF
68 70
69 71 $ cat >> .hg/hgrc <<EOF
70 72 > [unsettest]
71 73 > local-hgrc = should be unset (.hg/hgrc)
72 74 > %unset local-hgrc
73 75 >
74 76 > %unset global
75 77 >
76 78 > both = should be unset (.hg/hgrc)
77 79 > %unset both
78 80 >
79 81 > set-after-unset = should be unset (.hg/hgrc)
80 82 > %unset set-after-unset
81 83 > set-after-unset = should be set (.hg/hgrc)
82 84 > EOF
83 85
84 86 $ hg showconfig unsettest
85 87 unsettest.set-after-unset=should be set (.hg/hgrc)
86 88
87 89 Test exit code when no config matches
88 90
89 91 $ hg config Section.idontexist
90 92 [1]
@@ -1,88 +1,90 b''
1 1
2 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "convert = " >> $HGRCPATH
4 $ echo "[convert]" >> $HGRCPATH
5 $ echo "hg.tagsbranch=0" >> $HGRCPATH
2 $ cat <<EOF >> $HGRCPATH
3 > [extensions]
4 > convert =
5 > [convert]
6 > hg.tagsbranch = 0
7 > EOF
6 8 $ hg init source
7 9 $ cd source
8 10 $ echo a > a
9 11 $ hg ci -qAm adda
10 12
11 13 Add a merge with one parent in the same branch
12 14
13 15 $ echo a >> a
14 16 $ hg ci -qAm changea
15 17 $ hg up -qC 0
16 18 $ hg branch branch0
17 19 marked working directory as branch branch0
18 20 (branches are permanent and global, did you want a bookmark?)
19 21 $ echo b > b
20 22 $ hg ci -qAm addb
21 23 $ hg up -qC
22 24 $ hg merge default
23 25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 26 (branch merge, don't forget to commit)
25 27 $ hg ci -qm mergeab
26 28 $ hg tag -ql mergeab
27 29 $ cd ..
28 30
29 31 Miss perl... sometimes
30 32
31 33 $ cat > filter.py <<EOF
32 34 > import sys, re
33 35 >
34 36 > r = re.compile(r'^(?:\d+|pulling from)')
35 37 > sys.stdout.writelines([l for l in sys.stdin if r.search(l)])
36 38 > EOF
37 39
38 40 convert
39 41
40 42 $ hg convert -v --config convert.hg.clonebranches=1 source dest |
41 43 > python filter.py
42 44 3 adda
43 45 2 changea
44 46 1 addb
45 47 pulling from default into branch0
46 48 1 changesets found
47 49 0 mergeab
48 50 pulling from default into branch0
49 51 1 changesets found
50 52
51 53 Add a merge with both parents and child in different branches
52 54
53 55 $ cd source
54 56 $ hg branch branch1
55 57 marked working directory as branch branch1
56 58 (branches are permanent and global, did you want a bookmark?)
57 59 $ echo a > file1
58 60 $ hg ci -qAm c1
59 61 $ hg up -qC mergeab
60 62 $ hg branch branch2
61 63 marked working directory as branch branch2
62 64 (branches are permanent and global, did you want a bookmark?)
63 65 $ echo a > file2
64 66 $ hg ci -qAm c2
65 67 $ hg merge branch1
66 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 69 (branch merge, don't forget to commit)
68 70 $ hg branch branch3
69 71 marked working directory as branch branch3
70 72 (branches are permanent and global, did you want a bookmark?)
71 73 $ hg ci -qAm c3
72 74 $ cd ..
73 75
74 76 incremental conversion
75 77
76 78 $ hg convert -v --config convert.hg.clonebranches=1 source dest |
77 79 > python filter.py
78 80 2 c1
79 81 pulling from branch0 into branch1
80 82 4 changesets found
81 83 1 c2
82 84 pulling from branch0 into branch2
83 85 4 changesets found
84 86 0 c3
85 87 pulling from branch1 into branch3
86 88 5 changesets found
87 89 pulling from branch2 into branch3
88 90 1 changesets found
@@ -1,193 +1,195 b''
1 1 #require cvs
2 2
3 3 This is http://mercurial.selenic.com/bts/issue1148
4 4 and http://mercurial.selenic.com/bts/issue1447
5 5
6 6 $ cvscall()
7 7 > {
8 8 > cvs -f "$@" > /dev/null
9 9 > }
10 $ echo "[extensions]" >> $HGRCPATH
11 $ echo "convert = " >> $HGRCPATH
12 $ echo "[convert]" >> $HGRCPATH
13 $ echo "cvsps.cache=0" >> $HGRCPATH
10 $ cat <<EOF >> $HGRCPATH
11 > [extensions]
12 > convert =
13 > [convert]
14 > cvsps.cache = 0
15 > EOF
14 16
15 17 create cvs repository
16 18
17 19 $ mkdir cvsrepo
18 20 $ cd cvsrepo
19 21 $ CVSROOT=`pwd`
20 22 $ export CVSROOT
21 23 $ CVS_OPTIONS=-f
22 24 $ export CVS_OPTIONS
23 25 $ cd ..
24 26 $ cvscall -q -d "$CVSROOT" init
25 27
26 28 Create a new project
27 29
28 30 $ mkdir src
29 31 $ cd src
30 32 $ echo "1" > a
31 33 $ echo "1" > b
32 34 $ cvscall import -m "init" src v0 r0 | sort
33 35 $ cd ..
34 36 $ cvscall co src
35 37 cvs checkout: Updating src
36 38 $ cd src
37 39
38 40 Branch the project
39 41
40 42 $ cvscall tag -b BRANCH
41 43 cvs tag: Tagging .
42 44 $ cvscall up -r BRANCH > /dev/null
43 45 cvs update: Updating .
44 46
45 47 Modify file a, then b, then a
46 48
47 49 $ sleep 1
48 50 $ echo "2" > a
49 51 $ cvscall ci -m "mod a"
50 52 cvs commit: Examining .
51 53 $ echo "2" > b
52 54 $ cvscall ci -m "mod b"
53 55 cvs commit: Examining .
54 56 $ sleep 1
55 57 $ echo "3" > a
56 58 $ cvscall ci -m "mod a again"
57 59 cvs commit: Examining .
58 60
59 61 Convert
60 62
61 63 $ cd ..
62 64 $ hg convert src
63 65 assuming destination src-hg
64 66 initializing destination src-hg repository
65 67 connecting to $TESTTMP/cvsrepo
66 68 scanning source...
67 69 collecting CVS rlog
68 70 7 log entries
69 71 creating changesets
70 72 5 changeset entries
71 73 sorting...
72 74 converting...
73 75 4 Initial revision
74 76 3 init
75 77 2 mod a
76 78 1 mod b
77 79 0 mod a again
78 80 updating tags
79 81
80 82 Check the result
81 83
82 84 $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} files: {files}\n'
83 85 o 5 () update tags files: .hgtags
84 86 |
85 87 | o 4 (BRANCH) mod a again files: a
86 88 | |
87 89 | o 3 (BRANCH) mod b files: b
88 90 | |
89 91 | o 2 (BRANCH) mod a files: a
90 92 | |
91 93 | o 1 (v0) init files:
92 94 |/
93 95 o 0 () Initial revision files: a b
94 96
95 97
96 98
97 99 issue 1447
98 100
99 101 $ cvscall()
100 102 > {
101 103 > cvs -f "$@" > /dev/null
102 104 > sleep 1
103 105 > }
104 106 $ cvsci()
105 107 > {
106 108 > cvs -f ci "$@" >/dev/null
107 109 > sleep 1
108 110 > }
109 111 $ cvscall -Q -d `pwd`/cvsmaster2 init
110 112 $ cd cvsmaster2
111 113 $ CVSROOT=`pwd`
112 114 $ export CVSROOT
113 115 $ mkdir foo
114 116 $ cd ..
115 117 $ cvscall -Q co -d cvswork2 foo
116 118 $ cd cvswork2
117 119 $ echo foo > a.txt
118 120 $ echo bar > b.txt
119 121 $ cvscall -Q add a.txt b.txt
120 122 $ cvsci -m "Initial commit"
121 123 cvs commit: Examining .
122 124 $ echo foo > b.txt
123 125 $ cvsci -m "Fix b on HEAD"
124 126 cvs commit: Examining .
125 127 $ echo bar > a.txt
126 128 $ cvsci -m "Small fix in a on HEAD"
127 129 cvs commit: Examining .
128 130 $ cvscall -Q tag -b BRANCH
129 131 $ cvscall -Q up -P -rBRANCH
130 132 $ echo baz > b.txt
131 133 $ cvsci -m "Change on BRANCH in b"
132 134 cvs commit: Examining .
133 135 $ hg debugcvsps -x --parents foo
134 136 collecting CVS rlog
135 137 5 log entries
136 138 creating changesets
137 139 4 changeset entries
138 140 ---------------------
139 141 PatchSet 1
140 142 Date: * (glob)
141 143 Author: * (glob)
142 144 Branch: HEAD
143 145 Tag: (none)
144 146 Log:
145 147 Initial commit
146 148
147 149 Members:
148 150 a.txt:INITIAL->1.1
149 151 b.txt:INITIAL->1.1
150 152
151 153 ---------------------
152 154 PatchSet 2
153 155 Date: * (glob)
154 156 Author: * (glob)
155 157 Branch: HEAD
156 158 Tag: (none)
157 159 Branchpoints: BRANCH
158 160 Parent: 1
159 161 Log:
160 162 Fix b on HEAD
161 163
162 164 Members:
163 165 b.txt:1.1->1.2
164 166
165 167 ---------------------
166 168 PatchSet 3
167 169 Date: * (glob)
168 170 Author: * (glob)
169 171 Branch: HEAD
170 172 Tag: (none)
171 173 Branchpoints: BRANCH
172 174 Parent: 2
173 175 Log:
174 176 Small fix in a on HEAD
175 177
176 178 Members:
177 179 a.txt:1.1->1.2
178 180
179 181 ---------------------
180 182 PatchSet 4
181 183 Date: * (glob)
182 184 Author: * (glob)
183 185 Branch: BRANCH
184 186 Tag: (none)
185 187 Parent: 3
186 188 Log:
187 189 Change on BRANCH in b
188 190
189 191 Members:
190 192 b.txt:1.2->1.2.2.1
191 193
192 194
193 195 $ cd ..
@@ -1,233 +1,235 b''
1 1 #require cvs
2 2
3 3 Test config convert.cvsps.mergefrom config setting.
4 4 (Should test similar mergeto feature, but I don't understand it yet.)
5 5 Requires builtin cvsps.
6 6
7 7 $ CVSROOT=`pwd`/cvsrepo
8 8 $ export CVSROOT
9 9
10 10 $ cvscall()
11 11 > {
12 12 > cvs -f "$@"
13 13 > }
14 14
15 15 output of 'cvs ci' varies unpredictably, so just discard it
16 16 XXX copied from test-convert-cvs-synthetic
17 17
18 18 $ cvsci()
19 19 > {
20 20 > sleep 1
21 21 > cvs -f ci "$@" > /dev/null
22 22 > }
23 23
24 24 XXX copied from test-convert-cvs-synthetic
25 25
26 $ echo "[extensions]" >> $HGRCPATH
27 $ echo "convert = " >> $HGRCPATH
28 $ echo "[convert]" >> $HGRCPATH
29 $ echo "cvsps.cache=0" >> $HGRCPATH
30 $ echo "cvsps.mergefrom=\[MERGE from (\S+)\]" >> $HGRCPATH
26 $ cat <<EOF >> $HGRCPATH
27 > [extensions]
28 > convert =
29 > [convert]
30 > cvsps.cache = 0
31 > cvsps.mergefrom = \[MERGE from (\S+)\]
32 > EOF
31 33
32 34 create cvs repository with one project
33 35
34 36 $ mkdir cvsrepo
35 37 $ cvscall -q -d "$CVSROOT" init
36 38 $ mkdir cvsrepo/proj
37 39
38 40 populate cvs repository
39 41
40 42 $ cvscall -Q co proj
41 43 $ cd proj
42 44 $ touch file1
43 45 $ cvscall -Q add file1
44 46 $ cvsci -m"add file1 on trunk"
45 47 cvs commit: Examining .
46 48
47 49 create two release branches
48 50
49 51 $ cvscall -q tag -b v1_0
50 52 T file1
51 53 $ cvscall -q tag -b v1_1
52 54 T file1
53 55
54 56 modify file1 on branch v1_0
55 57
56 58 $ cvscall -Q update -rv1_0
57 59 $ sleep 1
58 60 $ echo "change" >> file1
59 61 $ cvsci -m"add text"
60 62 cvs commit: Examining .
61 63
62 64 make unrelated change on v1_1
63 65
64 66 $ cvscall -Q update -rv1_1
65 67 $ touch unrelated
66 68 $ cvscall -Q add unrelated
67 69 $ cvsci -m"unrelated change"
68 70 cvs commit: Examining .
69 71
70 72 merge file1 to v1_1
71 73
72 74 $ cvscall -Q update -jv1_0
73 75 RCS file: $TESTTMP/cvsrepo/proj/file1,v
74 76 retrieving revision 1.1
75 77 retrieving revision 1.1.2.1
76 78 Merging differences between 1.1 and 1.1.2.1 into file1
77 79 $ cvsci -m"add text [MERGE from v1_0]"
78 80 cvs commit: Examining .
79 81
80 82 merge change to trunk
81 83
82 84 $ cvscall -Q update -A
83 85 $ cvscall -Q update -jv1_1
84 86 RCS file: $TESTTMP/cvsrepo/proj/file1,v
85 87 retrieving revision 1.1
86 88 retrieving revision 1.1.4.1
87 89 Merging differences between 1.1 and 1.1.4.1 into file1
88 90 $ cvsci -m"add text [MERGE from v1_1]"
89 91 cvs commit: Examining .
90 92
91 93 non-merged change on trunk
92 94
93 95 $ echo "foo" > file2
94 96 $ cvscall -Q add file2
95 97 $ cvsci -m"add file2 on trunk" file2
96 98
97 99 this will create rev 1.3
98 100 change on trunk to backport
99 101
100 102 $ echo "backport me" >> file1
101 103 $ cvsci -m"add other text" file1
102 104 $ cvscall log file1
103 105
104 106 RCS file: $TESTTMP/cvsrepo/proj/file1,v
105 107 Working file: file1
106 108 head: 1.3
107 109 branch:
108 110 locks: strict
109 111 access list:
110 112 symbolic names:
111 113 v1_1: 1.1.0.4
112 114 v1_0: 1.1.0.2
113 115 keyword substitution: kv
114 116 total revisions: 5; selected revisions: 5
115 117 description:
116 118 ----------------------------
117 119 revision 1.3
118 120 date: * (glob)
119 121 add other text
120 122 ----------------------------
121 123 revision 1.2
122 124 date: * (glob)
123 125 add text [MERGE from v1_1]
124 126 ----------------------------
125 127 revision 1.1
126 128 date: * (glob)
127 129 branches: 1.1.2; 1.1.4;
128 130 add file1 on trunk
129 131 ----------------------------
130 132 revision 1.1.4.1
131 133 date: * (glob)
132 134 add text [MERGE from v1_0]
133 135 ----------------------------
134 136 revision 1.1.2.1
135 137 date: * (glob)
136 138 add text
137 139 =============================================================================
138 140
139 141 XXX how many ways are there to spell "trunk" with CVS?
140 142 backport trunk change to v1_1
141 143
142 144 $ cvscall -Q update -rv1_1
143 145 $ cvscall -Q update -j1.2 -j1.3 file1
144 146 RCS file: $TESTTMP/cvsrepo/proj/file1,v
145 147 retrieving revision 1.2
146 148 retrieving revision 1.3
147 149 Merging differences between 1.2 and 1.3 into file1
148 150 $ cvsci -m"add other text [MERGE from HEAD]" file1
149 151
150 152 fix bug on v1_1, merge to trunk with error
151 153
152 154 $ cvscall -Q update -rv1_1
153 155 $ echo "merge forward" >> file1
154 156 $ cvscall -Q tag unmerged
155 157 $ cvsci -m"fix file1"
156 158 cvs commit: Examining .
157 159 $ cvscall -Q update -A
158 160 $ cvscall -Q update -junmerged -jv1_1
159 161 RCS file: $TESTTMP/cvsrepo/proj/file1,v
160 162 retrieving revision 1.1.4.2
161 163 retrieving revision 1.1.4.3
162 164 Merging differences between 1.1.4.2 and 1.1.4.3 into file1
163 165
164 166 note the typo in the commit log message
165 167
166 168 $ cvsci -m"fix file1 [MERGE from v1-1]"
167 169 cvs commit: Examining .
168 170 $ cvs -Q tag -d unmerged
169 171
170 172 convert to hg
171 173
172 174 $ cd ..
173 175 $ hg convert proj proj.hg
174 176 initializing destination proj.hg repository
175 177 connecting to $TESTTMP/cvsrepo
176 178 scanning source...
177 179 collecting CVS rlog
178 180 12 log entries
179 181 creating changesets
180 182 warning: CVS commit message references non-existent branch 'v1-1':
181 183 fix file1 [MERGE from v1-1]
182 184 10 changeset entries
183 185 sorting...
184 186 converting...
185 187 9 add file1 on trunk
186 188 8 unrelated change
187 189 7 add text
188 190 6 add text [MERGE from v1_0]
189 191 5 add text [MERGE from v1_1]
190 192 4 add file2 on trunk
191 193 3 add other text
192 194 2 add other text [MERGE from HEAD]
193 195 1 fix file1
194 196 0 fix file1 [MERGE from v1-1]
195 197
196 198 complete log
197 199
198 200 $ template="{rev}: '{branches}' {desc}\n"
199 201 $ hg -R proj.hg log --template="$template"
200 202 9: '' fix file1 [MERGE from v1-1]
201 203 8: 'v1_1' fix file1
202 204 7: 'v1_1' add other text [MERGE from HEAD]
203 205 6: '' add other text
204 206 5: '' add file2 on trunk
205 207 4: '' add text [MERGE from v1_1]
206 208 3: 'v1_1' add text [MERGE from v1_0]
207 209 2: 'v1_0' add text
208 210 1: 'v1_1' unrelated change
209 211 0: '' add file1 on trunk
210 212
211 213 graphical log
212 214
213 215 $ hg -R proj.hg log -G --template="$template"
214 216 o 9: '' fix file1 [MERGE from v1-1]
215 217 |
216 218 | o 8: 'v1_1' fix file1
217 219 | |
218 220 | o 7: 'v1_1' add other text [MERGE from HEAD]
219 221 |/|
220 222 o | 6: '' add other text
221 223 | |
222 224 o | 5: '' add file2 on trunk
223 225 | |
224 226 o | 4: '' add text [MERGE from v1_1]
225 227 |\|
226 228 | o 3: 'v1_1' add text [MERGE from v1_0]
227 229 | |\
228 230 +---o 2: 'v1_0' add text
229 231 | |
230 232 | o 1: 'v1_1' unrelated change
231 233 |/
232 234 o 0: '' add file1 on trunk
233 235
@@ -1,467 +1,469 b''
1 1 #require cvs
2 2
3 3 $ cvscall()
4 4 > {
5 5 > cvs -f "$@"
6 6 > }
7 7 $ hgcat()
8 8 > {
9 9 > hg --cwd src-hg cat -r tip "$1"
10 10 > }
11 11 $ echo "[extensions]" >> $HGRCPATH
12 12 $ echo "convert = " >> $HGRCPATH
13 13 $ cat > cvshooks.py <<EOF
14 14 > def cvslog(ui,repo,hooktype,log):
15 15 > print "%s hook: %d entries"%(hooktype,len(log))
16 16 >
17 17 > def cvschangesets(ui,repo,hooktype,changesets):
18 18 > print "%s hook: %d changesets"%(hooktype,len(changesets))
19 19 > EOF
20 20 $ hookpath=`pwd`
21 $ echo "[hooks]" >> $HGRCPATH
22 $ echo "cvslog=python:$hookpath/cvshooks.py:cvslog" >> $HGRCPATH
23 $ echo "cvschangesets=python:$hookpath/cvshooks.py:cvschangesets" >> $HGRCPATH
21 $ cat <<EOF >> $HGRCPATH
22 > [hooks]
23 > cvslog = python:$hookpath/cvshooks.py:cvslog
24 > cvschangesets = python:$hookpath/cvshooks.py:cvschangesets
25 > EOF
24 26
25 27 create cvs repository
26 28
27 29 $ mkdir cvsrepo
28 30 $ cd cvsrepo
29 31 $ CVSROOT=`pwd`
30 32 $ export CVSROOT
31 33 $ CVS_OPTIONS=-f
32 34 $ export CVS_OPTIONS
33 35 $ cd ..
34 36 $ cvscall -q -d "$CVSROOT" init
35 37
36 38 create source directory
37 39
38 40 $ mkdir src-temp
39 41 $ cd src-temp
40 42 $ echo a > a
41 43 $ mkdir b
42 44 $ cd b
43 45 $ echo c > c
44 46 $ cd ..
45 47
46 48 import source directory
47 49
48 50 $ cvscall -q import -m import src INITIAL start
49 51 N src/a
50 52 N src/b/c
51 53
52 54 No conflicts created by this import
53 55
54 56 $ cd ..
55 57
56 58 checkout source directory
57 59
58 60 $ cvscall -q checkout src
59 61 U src/a
60 62 U src/b/c
61 63
62 64 commit a new revision changing b/c
63 65
64 66 $ cd src
65 67 $ sleep 1
66 68 $ echo c >> b/c
67 69 $ cvscall -q commit -mci0 . | grep '<--'
68 70 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
69 71 $ cd ..
70 72
71 73 convert fresh repo and also check localtimezone option
72 74
73 75 NOTE: This doesn't check all time zones -- it merely determines that
74 76 the configuration option is taking effect.
75 77
76 78 An arbitrary (U.S.) time zone is used here. TZ=US/Hawaii is selected
77 79 since it does not use DST (unlike other U.S. time zones) and is always
78 80 a fixed difference from UTC.
79 81
80 82 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
81 83 initializing destination src-hg repository
82 84 connecting to $TESTTMP/cvsrepo
83 85 scanning source...
84 86 collecting CVS rlog
85 87 5 log entries
86 88 cvslog hook: 5 entries
87 89 creating changesets
88 90 3 changeset entries
89 91 cvschangesets hook: 3 changesets
90 92 sorting...
91 93 converting...
92 94 2 Initial revision
93 95 1 ci0
94 96 0 import
95 97 updating tags
96 98 $ hgcat a
97 99 a
98 100 $ hgcat b/c
99 101 c
100 102 c
101 103
102 104 convert fresh repo with --filemap
103 105
104 106 $ echo include b/c > filemap
105 107 $ hg convert --filemap filemap src src-filemap
106 108 initializing destination src-filemap repository
107 109 connecting to $TESTTMP/cvsrepo
108 110 scanning source...
109 111 collecting CVS rlog
110 112 5 log entries
111 113 cvslog hook: 5 entries
112 114 creating changesets
113 115 3 changeset entries
114 116 cvschangesets hook: 3 changesets
115 117 sorting...
116 118 converting...
117 119 2 Initial revision
118 120 1 ci0
119 121 0 import
120 122 filtering out empty revision
121 123 repository tip rolled back to revision 1 (undo commit)
122 124 updating tags
123 125 $ hgcat b/c
124 126 c
125 127 c
126 128 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
127 129 2 update tags files: .hgtags
128 130 1 ci0 files: b/c
129 131 0 Initial revision files: b/c
130 132
131 133 convert full repository (issue1649)
132 134
133 135 $ cvscall -q -d "$CVSROOT" checkout -d srcfull "." | grep -v CVSROOT
134 136 U srcfull/src/a
135 137 U srcfull/src/b/c
136 138 $ ls srcfull
137 139 CVS
138 140 CVSROOT
139 141 src
140 142 $ hg convert srcfull srcfull-hg \
141 143 > | grep -v 'log entries' | grep -v 'hook:' \
142 144 > | grep -v '^[0-3] .*' # filter instable changeset order
143 145 initializing destination srcfull-hg repository
144 146 connecting to $TESTTMP/cvsrepo
145 147 scanning source...
146 148 collecting CVS rlog
147 149 creating changesets
148 150 4 changeset entries
149 151 sorting...
150 152 converting...
151 153 updating tags
152 154 $ hg cat -r tip --cwd srcfull-hg src/a
153 155 a
154 156 $ hg cat -r tip --cwd srcfull-hg src/b/c
155 157 c
156 158 c
157 159
158 160 commit new file revisions
159 161
160 162 $ cd src
161 163 $ echo a >> a
162 164 $ echo c >> b/c
163 165 $ cvscall -q commit -mci1 . | grep '<--'
164 166 $TESTTMP/cvsrepo/src/a,v <-- a
165 167 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
166 168 $ cd ..
167 169
168 170 convert again
169 171
170 172 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
171 173 connecting to $TESTTMP/cvsrepo
172 174 scanning source...
173 175 collecting CVS rlog
174 176 7 log entries
175 177 cvslog hook: 7 entries
176 178 creating changesets
177 179 4 changeset entries
178 180 cvschangesets hook: 4 changesets
179 181 sorting...
180 182 converting...
181 183 0 ci1
182 184 $ hgcat a
183 185 a
184 186 a
185 187 $ hgcat b/c
186 188 c
187 189 c
188 190 c
189 191
190 192 convert again with --filemap
191 193
192 194 $ hg convert --filemap filemap src src-filemap
193 195 connecting to $TESTTMP/cvsrepo
194 196 scanning source...
195 197 collecting CVS rlog
196 198 7 log entries
197 199 cvslog hook: 7 entries
198 200 creating changesets
199 201 4 changeset entries
200 202 cvschangesets hook: 4 changesets
201 203 sorting...
202 204 converting...
203 205 0 ci1
204 206 $ hgcat b/c
205 207 c
206 208 c
207 209 c
208 210 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
209 211 3 ci1 files: b/c
210 212 2 update tags files: .hgtags
211 213 1 ci0 files: b/c
212 214 0 Initial revision files: b/c
213 215
214 216 commit branch
215 217
216 218 $ cd src
217 219 $ cvs -q update -r1.1 b/c
218 220 U b/c
219 221 $ cvs -q tag -b branch
220 222 T a
221 223 T b/c
222 224 $ cvs -q update -r branch > /dev/null
223 225 $ echo d >> b/c
224 226 $ cvs -q commit -mci2 . | grep '<--'
225 227 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
226 228 $ cd ..
227 229
228 230 convert again
229 231
230 232 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True src src-hg
231 233 connecting to $TESTTMP/cvsrepo
232 234 scanning source...
233 235 collecting CVS rlog
234 236 8 log entries
235 237 cvslog hook: 8 entries
236 238 creating changesets
237 239 5 changeset entries
238 240 cvschangesets hook: 5 changesets
239 241 sorting...
240 242 converting...
241 243 0 ci2
242 244 $ hgcat b/c
243 245 c
244 246 d
245 247
246 248 convert again with --filemap
247 249
248 250 $ TZ=US/Hawaii hg convert --config convert.localtimezone=True --filemap filemap src src-filemap
249 251 connecting to $TESTTMP/cvsrepo
250 252 scanning source...
251 253 collecting CVS rlog
252 254 8 log entries
253 255 cvslog hook: 8 entries
254 256 creating changesets
255 257 5 changeset entries
256 258 cvschangesets hook: 5 changesets
257 259 sorting...
258 260 converting...
259 261 0 ci2
260 262 $ hgcat b/c
261 263 c
262 264 d
263 265 $ hg -R src-filemap log --template '{rev} {desc} files: {files}\n'
264 266 4 ci2 files: b/c
265 267 3 ci1 files: b/c
266 268 2 update tags files: .hgtags
267 269 1 ci0 files: b/c
268 270 0 Initial revision files: b/c
269 271
270 272 commit a new revision with funny log message
271 273
272 274 $ cd src
273 275 $ sleep 1
274 276 $ echo e >> a
275 277 $ cvscall -q commit -m'funny
276 278 > ----------------------------
277 279 > log message' . | grep '<--' |\
278 280 > sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
279 281 checking in src/a,v
280 282
281 283 commit new file revisions with some fuzz
282 284
283 285 $ sleep 1
284 286 $ echo f >> a
285 287 $ cvscall -q commit -mfuzzy . | grep '<--'
286 288 $TESTTMP/cvsrepo/src/a,v <-- a
287 289 $ sleep 4 # the two changes will be split if fuzz < 4
288 290 $ echo g >> b/c
289 291 $ cvscall -q commit -mfuzzy . | grep '<--'
290 292 $TESTTMP/cvsrepo/src/b/c,v <-- *c (glob)
291 293 $ cd ..
292 294
293 295 convert again
294 296
295 297 $ TZ=US/Hawaii hg convert --config convert.cvsps.fuzz=2 --config convert.localtimezone=True src src-hg
296 298 connecting to $TESTTMP/cvsrepo
297 299 scanning source...
298 300 collecting CVS rlog
299 301 11 log entries
300 302 cvslog hook: 11 entries
301 303 creating changesets
302 304 8 changeset entries
303 305 cvschangesets hook: 8 changesets
304 306 sorting...
305 307 converting...
306 308 2 funny
307 309 1 fuzzy
308 310 0 fuzzy
309 311 $ hg -R src-hg log -G --template '{rev} ({branches}) {desc} date: {date|date} files: {files}\n'
310 312 o 8 (branch) fuzzy date: * -1000 files: b/c (glob)
311 313 |
312 314 o 7 (branch) fuzzy date: * -1000 files: a (glob)
313 315 |
314 316 o 6 (branch) funny
315 317 | ----------------------------
316 318 | log message date: * -1000 files: a (glob)
317 319 o 5 (branch) ci2 date: * -1000 files: b/c (glob)
318 320
319 321 o 4 () ci1 date: * -1000 files: a b/c (glob)
320 322 |
321 323 o 3 () update tags date: * +0000 files: .hgtags (glob)
322 324 |
323 325 | o 2 (INITIAL) import date: * -1000 files: (glob)
324 326 | |
325 327 o | 1 () ci0 date: * -1000 files: b/c (glob)
326 328 |/
327 329 o 0 () Initial revision date: * -1000 files: a b/c (glob)
328 330
329 331
330 332 testing debugcvsps
331 333
332 334 $ cd src
333 335 $ hg debugcvsps --fuzz=2
334 336 collecting CVS rlog
335 337 11 log entries
336 338 cvslog hook: 11 entries
337 339 creating changesets
338 340 10 changeset entries
339 341 cvschangesets hook: 10 changesets
340 342 ---------------------
341 343 PatchSet 1
342 344 Date: * (glob)
343 345 Author: * (glob)
344 346 Branch: HEAD
345 347 Tag: (none)
346 348 Branchpoints: INITIAL
347 349 Log:
348 350 Initial revision
349 351
350 352 Members:
351 353 a:INITIAL->1.1
352 354
353 355 ---------------------
354 356 PatchSet 2
355 357 Date: * (glob)
356 358 Author: * (glob)
357 359 Branch: HEAD
358 360 Tag: (none)
359 361 Branchpoints: INITIAL, branch
360 362 Log:
361 363 Initial revision
362 364
363 365 Members:
364 366 b/c:INITIAL->1.1
365 367
366 368 ---------------------
367 369 PatchSet 3
368 370 Date: * (glob)
369 371 Author: * (glob)
370 372 Branch: INITIAL
371 373 Tag: start
372 374 Log:
373 375 import
374 376
375 377 Members:
376 378 a:1.1->1.1.1.1
377 379 b/c:1.1->1.1.1.1
378 380
379 381 ---------------------
380 382 PatchSet 4
381 383 Date: * (glob)
382 384 Author: * (glob)
383 385 Branch: HEAD
384 386 Tag: (none)
385 387 Log:
386 388 ci0
387 389
388 390 Members:
389 391 b/c:1.1->1.2
390 392
391 393 ---------------------
392 394 PatchSet 5
393 395 Date: * (glob)
394 396 Author: * (glob)
395 397 Branch: HEAD
396 398 Tag: (none)
397 399 Log:
398 400 ci1
399 401
400 402 Members:
401 403 b/c:1.2->1.3
402 404
403 405 ---------------------
404 406 PatchSet 6
405 407 Date: * (glob)
406 408 Author: * (glob)
407 409 Branch: HEAD
408 410 Tag: (none)
409 411 Branchpoints: branch
410 412 Log:
411 413 ci1
412 414
413 415 Members:
414 416 a:1.1->1.2
415 417
416 418 ---------------------
417 419 PatchSet 7
418 420 Date: * (glob)
419 421 Author: * (glob)
420 422 Branch: branch
421 423 Tag: (none)
422 424 Log:
423 425 ci2
424 426
425 427 Members:
426 428 b/c:1.1->1.1.2.1
427 429
428 430 ---------------------
429 431 PatchSet 8
430 432 Date: * (glob)
431 433 Author: * (glob)
432 434 Branch: branch
433 435 Tag: (none)
434 436 Log:
435 437 funny
436 438 ----------------------------
437 439 log message
438 440
439 441 Members:
440 442 a:1.2->1.2.2.1
441 443
442 444 ---------------------
443 445 PatchSet 9
444 446 Date: * (glob)
445 447 Author: * (glob)
446 448 Branch: branch
447 449 Tag: (none)
448 450 Log:
449 451 fuzzy
450 452
451 453 Members:
452 454 a:1.2.2.1->1.2.2.2
453 455
454 456 ---------------------
455 457 PatchSet 10
456 458 Date: * (glob)
457 459 Author: * (glob)
458 460 Branch: branch
459 461 Tag: (none)
460 462 Log:
461 463 fuzzy
462 464
463 465 Members:
464 466 b/c:1.1.2.1->1.1.2.2
465 467
466 468
467 469 $ cd ..
@@ -1,116 +1,118 b''
1 1 #require svn svn-bindings
2 2
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "convert = " >> $HGRCPATH
5 $ echo "mq = " >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
5 > convert =
6 > mq =
7 > EOF
6 8
7 9 $ SVNREPOPATH=`pwd`/svn-repo
8 10 #if windows
9 11 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
10 12 #else
11 13 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
12 14 #endif
13 15
14 16 $ svnadmin create "$SVNREPOPATH"
15 17 $ cat > "$SVNREPOPATH"/hooks/pre-revprop-change <<EOF
16 18 > #!/bin/sh
17 19 >
18 20 > REPOS="$1"
19 21 > REV="$2"
20 22 > USER="$3"
21 23 > PROPNAME="$4"
22 24 > ACTION="$5"
23 25 >
24 26 > if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
25 27 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-branch" ]; then exit 0; fi
26 28 > if [ "$ACTION" = "A" -a "$PROPNAME" = "hg:convert-rev" ]; then exit 0; fi
27 29 >
28 30 > echo "Changing prohibited revision property" >&2
29 31 > exit 1
30 32 > EOF
31 33 $ chmod +x "$SVNREPOPATH"/hooks/pre-revprop-change
32 34 $ svn co "$SVNREPOURL" "$SVNREPOPATH"-wc
33 35 Checked out revision 0.
34 36 $ cd "$SVNREPOPATH"-wc
35 37 $ echo a > a
36 38 $ svn add a
37 39 A a
38 40 $ svn ci -m'added a' a
39 41 Adding a
40 42 Transmitting file data .
41 43 Committed revision 1.
42 44 $ cd ..
43 45
44 46 initial roundtrip
45 47
46 48 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg | grep -v initializing
47 49 scanning source...
48 50 sorting...
49 51 converting...
50 52 0 added a
51 53 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
52 54 scanning source...
53 55 sorting...
54 56 converting...
55 57
56 58 second roundtrip should do nothing
57 59
58 60 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
59 61 scanning source...
60 62 sorting...
61 63 converting...
62 64 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
63 65 scanning source...
64 66 sorting...
65 67 converting...
66 68
67 69 new hg rev
68 70
69 71 $ hg clone "$SVNREPOPATH"-hg "$SVNREPOPATH"-work
70 72 updating to branch default
71 73 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 74 $ cd "$SVNREPOPATH"-work
73 75 $ echo b > b
74 76 $ hg add b
75 77 $ hg ci -mb
76 78
77 79 adding an empty revision
78 80
79 81 $ hg qnew -m emtpy empty
80 82 $ hg qfinish -a
81 83 $ cd ..
82 84
83 85 echo hg to svn
84 86
85 87 $ hg --cwd "$SVNREPOPATH"-hg pull -q "$SVNREPOPATH"-work
86 88 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
87 89 scanning source...
88 90 sorting...
89 91 converting...
90 92 1 b
91 93 0 emtpy
92 94
93 95 svn back to hg should do nothing
94 96
95 97 $ hg convert -s svn -d hg "$SVNREPOPATH"-wc "$SVNREPOPATH"-hg
96 98 scanning source...
97 99 sorting...
98 100 converting...
99 101
100 102 hg back to svn should do nothing
101 103
102 104 $ hg convert -s hg -d svn "$SVNREPOPATH"-hg "$SVNREPOPATH"-wc
103 105 scanning source...
104 106 sorting...
105 107 converting...
106 108
107 109 verify which shamap format we are storing and must be able to handle
108 110
109 111 $ cat svn-repo-hg/.hg/shamap
110 112 svn:????????-????-????-????-????????????@1 ???????????????????????????????????????? (glob)
111 113 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
112 114 svn:????????-????-????-????-????????????@2 ???????????????????????????????????????? (glob)
113 115 $ cat svn-repo-wc/.svn/hg-shamap
114 116 ???????????????????????????????????????? 1 (glob)
115 117 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
116 118 ???????????????????????????????????????? svn:????????-????-????-????-????????????@2 (glob)
@@ -1,89 +1,91 b''
1 1 #require git
2 2
3 3 $ echo "[core]" >> $HOME/.gitconfig
4 4 $ echo "autocrlf = false" >> $HOME/.gitconfig
5 5 $ echo "[core]" >> $HOME/.gitconfig
6 6 $ echo "autocrlf = false" >> $HOME/.gitconfig
7 $ echo "[extensions]" >> $HGRCPATH
8 $ echo "convert=" >> $HGRCPATH
9 $ echo '[convert]' >> $HGRCPATH
10 $ echo 'hg.usebranchnames = True' >> $HGRCPATH
11 $ echo 'hg.tagsbranch = tags-update' >> $HGRCPATH
7 $ cat <<EOF >> $HGRCPATH
8 > [extensions]
9 > convert =
10 > [convert]
11 > hg.usebranchnames = True
12 > hg.tagsbranch = tags-update
13 > EOF
12 14 $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
13 15 $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL
14 16 $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE
15 17 $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME
16 18 $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL
17 19 $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE
18 20 $ count=10
19 21 $ action()
20 22 > {
21 23 > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000"
22 24 > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
23 25 > git "$@" >/dev/null 2>/dev/null || echo "git command error"
24 26 > count=`expr $count + 1`
25 27 > }
26 28 $ glog()
27 29 > {
28 30 > hg log -G --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
29 31 > }
30 32 $ convertrepo()
31 33 > {
32 34 > hg convert --datesort git-repo hg-repo
33 35 > }
34 36
35 37 Build a GIT repo with at least 1 tag
36 38
37 39 $ mkdir git-repo
38 40 $ cd git-repo
39 41 $ git init >/dev/null 2>&1
40 42 $ echo a > a
41 43 $ git add a
42 44 $ action commit -m "rev1"
43 45 $ action tag -m "tag1" tag1
44 46 $ cd ..
45 47
46 48 Do a first conversion
47 49
48 50 $ convertrepo
49 51 initializing destination hg-repo repository
50 52 scanning source...
51 53 sorting...
52 54 converting...
53 55 0 rev1
54 56 updating tags
55 57 updating bookmarks
56 58
57 59 Simulate upstream updates after first conversion
58 60
59 61 $ cd git-repo
60 62 $ echo b > a
61 63 $ git add a
62 64 $ action commit -m "rev2"
63 65 $ action tag -m "tag2" tag2
64 66 $ cd ..
65 67
66 68 Perform an incremental conversion
67 69
68 70 $ convertrepo
69 71 scanning source...
70 72 sorting...
71 73 converting...
72 74 0 rev2
73 75 updating tags
74 76 updating bookmarks
75 77
76 78 Print the log
77 79
78 80 $ cd hg-repo
79 81 $ glog
80 82 o 3 "update tags" files: .hgtags
81 83 |
82 84 | o 2 "rev2" files: a
83 85 | |
84 86 o | 1 "update tags" files: .hgtags
85 87 /
86 88 o 0 "rev1" files: a
87 89
88 90
89 91 $ cd ..
@@ -1,206 +1,210 b''
1 1 Setup
2 2
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode = ansi" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "color=" >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [color]
5 > mode = ansi
6 > [extensions]
7 > color =
8 > EOF
7 9 $ hg init repo
8 10 $ cd repo
9 11 $ cat > a <<EOF
10 12 > c
11 13 > c
12 14 > a
13 15 > a
14 16 > b
15 17 > a
16 18 > a
17 19 > c
18 20 > c
19 21 > EOF
20 22 $ hg ci -Am adda
21 23 adding a
22 24 $ cat > a <<EOF
23 25 > c
24 26 > c
25 27 > a
26 28 > a
27 29 > dd
28 30 > a
29 31 > a
30 32 > c
31 33 > c
32 34 > EOF
33 35
34 36 default context
35 37
36 38 $ hg diff --nodates --color=always
37 39 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
38 40 \x1b[0;31;1m--- a/a\x1b[0m (esc)
39 41 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
40 42 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
41 43 c
42 44 a
43 45 a
44 46 \x1b[0;31m-b\x1b[0m (esc)
45 47 \x1b[0;32m+dd\x1b[0m (esc)
46 48 a
47 49 a
48 50 c
49 51
50 52 --unified=2
51 53
52 54 $ hg diff --nodates -U 2 --color=always
53 55 \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
54 56 \x1b[0;31;1m--- a/a\x1b[0m (esc)
55 57 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
56 58 \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc)
57 59 a
58 60 a
59 61 \x1b[0;31m-b\x1b[0m (esc)
60 62 \x1b[0;32m+dd\x1b[0m (esc)
61 63 a
62 64 a
63 65
64 66 diffstat
65 67
66 68 $ hg diff --stat --color=always
67 69 a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc)
68 70 1 files changed, 1 insertions(+), 1 deletions(-)
69 $ echo "record=" >> $HGRCPATH
70 $ echo "[ui]" >> $HGRCPATH
71 $ echo "interactive=true" >> $HGRCPATH
72 $ echo "[diff]" >> $HGRCPATH
73 $ echo "git=True" >> $HGRCPATH
71 $ cat <<EOF >> $HGRCPATH
72 > record =
73 > [ui]
74 > interactive = true
75 > [diff]
76 > git = True
77 > EOF
74 78
75 79 #if execbit
76 80
77 81 record
78 82
79 83 $ chmod +x a
80 84 $ hg record --color=always -m moda a <<EOF
81 85 > y
82 86 > y
83 87 > EOF
84 88 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
85 89 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
86 90 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
87 91 1 hunks, 1 lines changed
88 92 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
89 93
90 94 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
91 95 c
92 96 a
93 97 a
94 98 \x1b[0;31m-b\x1b[0m (esc)
95 99 \x1b[0;32m+dd\x1b[0m (esc)
96 100 a
97 101 a
98 102 c
99 103 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
100 104
101 105
102 106 $ echo "[extensions]" >> $HGRCPATH
103 107 $ echo "mq=" >> $HGRCPATH
104 108 $ hg rollback
105 109 repository tip rolled back to revision 0 (undo commit)
106 110 working directory now based on revision 0
107 111
108 112 qrecord
109 113
110 114 $ hg qrecord --color=always -m moda patch <<EOF
111 115 > y
112 116 > y
113 117 > EOF
114 118 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
115 119 \x1b[0;36;1mold mode 100644\x1b[0m (esc)
116 120 \x1b[0;36;1mnew mode 100755\x1b[0m (esc)
117 121 1 hunks, 1 lines changed
118 122 \x1b[0;33mexamine changes to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
119 123
120 124 \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc)
121 125 c
122 126 a
123 127 a
124 128 \x1b[0;31m-b\x1b[0m (esc)
125 129 \x1b[0;32m+dd\x1b[0m (esc)
126 130 a
127 131 a
128 132 c
129 133 \x1b[0;33mrecord this change to 'a'? [Ynesfdaq?]\x1b[0m y (esc)
130 134
131 135
132 136 $ hg qpop -a
133 137 popping patch
134 138 patch queue now empty
135 139
136 140 #endif
137 141
138 142 issue3712: test colorization of subrepo diff
139 143
140 144 $ hg init sub
141 145 $ echo b > sub/b
142 146 $ hg -R sub commit -Am 'create sub'
143 147 adding b
144 148 $ echo 'sub = sub' > .hgsub
145 149 $ hg add .hgsub
146 150 $ hg commit -m 'add subrepo sub'
147 151 $ echo aa >> a
148 152 $ echo bb >> sub/b
149 153
150 154 $ hg diff --color=always -S
151 155 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
152 156 \x1b[0;31;1m--- a/a\x1b[0m (esc)
153 157 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
154 158 \x1b[0;35m@@ -7,3 +7,4 @@\x1b[0m (esc)
155 159 a
156 160 c
157 161 c
158 162 \x1b[0;32m+aa\x1b[0m (esc)
159 163 \x1b[0;1mdiff --git a/sub/b b/sub/b\x1b[0m (esc)
160 164 \x1b[0;31;1m--- a/sub/b\x1b[0m (esc)
161 165 \x1b[0;32;1m+++ b/sub/b\x1b[0m (esc)
162 166 \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc)
163 167 b
164 168 \x1b[0;32m+bb\x1b[0m (esc)
165 169
166 170 test tabs
167 171
168 172 $ cat >> a <<EOF
169 173 > one tab
170 174 > two tabs
171 175 > end tab
172 176 > mid tab
173 177 > all tabs
174 178 > EOF
175 179 $ hg diff --nodates --color=always
176 180 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
177 181 \x1b[0;31;1m--- a/a\x1b[0m (esc)
178 182 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
179 183 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
180 184 a
181 185 c
182 186 c
183 187 \x1b[0;32m+aa\x1b[0m (esc)
184 188 \x1b[0;32m+\x1b[0m \x1b[0;32mone tab\x1b[0m (esc)
185 189 \x1b[0;32m+\x1b[0m \x1b[0;32mtwo tabs\x1b[0m (esc)
186 190 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
187 191 \x1b[0;32m+mid\x1b[0m \x1b[0;32mtab\x1b[0m (esc)
188 192 \x1b[0;32m+\x1b[0m \x1b[0;32mall\x1b[0m \x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
189 193 $ echo "[color]" >> $HGRCPATH
190 194 $ echo "diff.tab = bold magenta" >> $HGRCPATH
191 195 $ hg diff --nodates --color=always
192 196 \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
193 197 \x1b[0;31;1m--- a/a\x1b[0m (esc)
194 198 \x1b[0;32;1m+++ b/a\x1b[0m (esc)
195 199 \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
196 200 a
197 201 c
198 202 c
199 203 \x1b[0;32m+aa\x1b[0m (esc)
200 204 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
201 205 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
202 206 \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
203 207 \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtab\x1b[0m (esc)
204 208 \x1b[0;32m+\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m \x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m \x1b[0m (esc)
205 209
206 210 $ cd ..
@@ -1,288 +1,290 b''
1 1 #require execbit
2 2
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "autodiff=$TESTDIR/autodiff.py" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
5 > autodiff = $TESTDIR/autodiff.py
6 > [diff]
7 > nodates = 1
8 > EOF
7 9
8 10 $ hg init repo
9 11 $ cd repo
10 12
11 13
12 14
13 15 make a combination of new, changed and deleted file
14 16
15 17 $ echo regular > regular
16 18 $ echo rmregular > rmregular
17 19 $ $PYTHON -c "file('bintoregular', 'wb').write('\0')"
18 20 $ touch rmempty
19 21 $ echo exec > exec
20 22 $ chmod +x exec
21 23 $ echo rmexec > rmexec
22 24 $ chmod +x rmexec
23 25 $ echo setexec > setexec
24 26 $ echo unsetexec > unsetexec
25 27 $ chmod +x unsetexec
26 28 $ echo binary > binary
27 29 $ $PYTHON -c "file('rmbinary', 'wb').write('\0')"
28 30 $ hg ci -Am addfiles
29 31 adding binary
30 32 adding bintoregular
31 33 adding exec
32 34 adding regular
33 35 adding rmbinary
34 36 adding rmempty
35 37 adding rmexec
36 38 adding rmregular
37 39 adding setexec
38 40 adding unsetexec
39 41 $ echo regular >> regular
40 42 $ echo newregular >> newregular
41 43 $ rm rmempty
42 44 $ touch newempty
43 45 $ rm rmregular
44 46 $ echo exec >> exec
45 47 $ echo newexec > newexec
46 48 $ echo bintoregular > bintoregular
47 49 $ chmod +x newexec
48 50 $ rm rmexec
49 51 $ chmod +x setexec
50 52 $ chmod -x unsetexec
51 53 $ $PYTHON -c "file('binary', 'wb').write('\0\0')"
52 54 $ $PYTHON -c "file('newbinary', 'wb').write('\0')"
53 55 $ rm rmbinary
54 56 $ hg addremove -s 0
55 57 adding newbinary
56 58 adding newempty
57 59 adding newexec
58 60 adding newregular
59 61 removing rmbinary
60 62 removing rmempty
61 63 removing rmexec
62 64 removing rmregular
63 65
64 66 git=no: regular diff for all files
65 67
66 68 $ hg autodiff --git=no
67 69 diff -r a66d19b9302d binary
68 70 Binary file binary has changed
69 71 diff -r a66d19b9302d bintoregular
70 72 Binary file bintoregular has changed
71 73 diff -r a66d19b9302d exec
72 74 --- a/exec
73 75 +++ b/exec
74 76 @@ -1,1 +1,2 @@
75 77 exec
76 78 +exec
77 79 diff -r a66d19b9302d newbinary
78 80 Binary file newbinary has changed
79 81 diff -r a66d19b9302d newexec
80 82 --- /dev/null
81 83 +++ b/newexec
82 84 @@ -0,0 +1,1 @@
83 85 +newexec
84 86 diff -r a66d19b9302d newregular
85 87 --- /dev/null
86 88 +++ b/newregular
87 89 @@ -0,0 +1,1 @@
88 90 +newregular
89 91 diff -r a66d19b9302d regular
90 92 --- a/regular
91 93 +++ b/regular
92 94 @@ -1,1 +1,2 @@
93 95 regular
94 96 +regular
95 97 diff -r a66d19b9302d rmbinary
96 98 Binary file rmbinary has changed
97 99 diff -r a66d19b9302d rmexec
98 100 --- a/rmexec
99 101 +++ /dev/null
100 102 @@ -1,1 +0,0 @@
101 103 -rmexec
102 104 diff -r a66d19b9302d rmregular
103 105 --- a/rmregular
104 106 +++ /dev/null
105 107 @@ -1,1 +0,0 @@
106 108 -rmregular
107 109
108 110 git=yes: git diff for single regular file
109 111
110 112 $ hg autodiff --git=yes regular
111 113 diff --git a/regular b/regular
112 114 --- a/regular
113 115 +++ b/regular
114 116 @@ -1,1 +1,2 @@
115 117 regular
116 118 +regular
117 119
118 120 git=auto: regular diff for regular files and non-binary removals
119 121
120 122 $ hg autodiff --git=auto regular newregular rmregular rmexec
121 123 diff -r a66d19b9302d newregular
122 124 --- /dev/null
123 125 +++ b/newregular
124 126 @@ -0,0 +1,1 @@
125 127 +newregular
126 128 diff -r a66d19b9302d regular
127 129 --- a/regular
128 130 +++ b/regular
129 131 @@ -1,1 +1,2 @@
130 132 regular
131 133 +regular
132 134 diff -r a66d19b9302d rmexec
133 135 --- a/rmexec
134 136 +++ /dev/null
135 137 @@ -1,1 +0,0 @@
136 138 -rmexec
137 139 diff -r a66d19b9302d rmregular
138 140 --- a/rmregular
139 141 +++ /dev/null
140 142 @@ -1,1 +0,0 @@
141 143 -rmregular
142 144
143 145 $ for f in exec newexec setexec unsetexec binary newbinary newempty rmempty rmbinary bintoregular; do
144 146 > echo
145 147 > echo '% git=auto: git diff for' $f
146 148 > hg autodiff --git=auto $f
147 149 > done
148 150
149 151 % git=auto: git diff for exec
150 152 diff -r a66d19b9302d exec
151 153 --- a/exec
152 154 +++ b/exec
153 155 @@ -1,1 +1,2 @@
154 156 exec
155 157 +exec
156 158
157 159 % git=auto: git diff for newexec
158 160 diff --git a/newexec b/newexec
159 161 new file mode 100755
160 162 --- /dev/null
161 163 +++ b/newexec
162 164 @@ -0,0 +1,1 @@
163 165 +newexec
164 166
165 167 % git=auto: git diff for setexec
166 168 diff --git a/setexec b/setexec
167 169 old mode 100644
168 170 new mode 100755
169 171
170 172 % git=auto: git diff for unsetexec
171 173 diff --git a/unsetexec b/unsetexec
172 174 old mode 100755
173 175 new mode 100644
174 176
175 177 % git=auto: git diff for binary
176 178 diff --git a/binary b/binary
177 179 index a9128c283485202893f5af379dd9beccb6e79486..09f370e38f498a462e1ca0faa724559b6630c04f
178 180 GIT binary patch
179 181 literal 2
180 182 Jc${Nk0000200961
181 183
182 184
183 185 % git=auto: git diff for newbinary
184 186 diff --git a/newbinary b/newbinary
185 187 new file mode 100644
186 188 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d
187 189 GIT binary patch
188 190 literal 1
189 191 Ic${MZ000310RR91
190 192
191 193
192 194 % git=auto: git diff for newempty
193 195 diff --git a/newempty b/newempty
194 196 new file mode 100644
195 197
196 198 % git=auto: git diff for rmempty
197 199 diff --git a/rmempty b/rmempty
198 200 deleted file mode 100644
199 201
200 202 % git=auto: git diff for rmbinary
201 203 diff --git a/rmbinary b/rmbinary
202 204 deleted file mode 100644
203 205 index f76dd238ade08917e6712764a16a22005a50573d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
204 206 GIT binary patch
205 207 literal 0
206 208 Hc$@<O00001
207 209
208 210
209 211 % git=auto: git diff for bintoregular
210 212 diff --git a/bintoregular b/bintoregular
211 213 index f76dd238ade08917e6712764a16a22005a50573d..9c42f2b6427d8bf034b7bc23986152dc01bfd3ab
212 214 GIT binary patch
213 215 literal 13
214 216 Uc$`bh%qz(+N=+}#Ni5<5043uE82|tP
215 217
216 218
217 219
218 220 git=warn: regular diff with data loss warnings
219 221
220 222 $ hg autodiff --git=warn
221 223 diff -r a66d19b9302d binary
222 224 Binary file binary has changed
223 225 diff -r a66d19b9302d bintoregular
224 226 Binary file bintoregular has changed
225 227 diff -r a66d19b9302d exec
226 228 --- a/exec
227 229 +++ b/exec
228 230 @@ -1,1 +1,2 @@
229 231 exec
230 232 +exec
231 233 diff -r a66d19b9302d newbinary
232 234 Binary file newbinary has changed
233 235 diff -r a66d19b9302d newexec
234 236 --- /dev/null
235 237 +++ b/newexec
236 238 @@ -0,0 +1,1 @@
237 239 +newexec
238 240 diff -r a66d19b9302d newregular
239 241 --- /dev/null
240 242 +++ b/newregular
241 243 @@ -0,0 +1,1 @@
242 244 +newregular
243 245 diff -r a66d19b9302d regular
244 246 --- a/regular
245 247 +++ b/regular
246 248 @@ -1,1 +1,2 @@
247 249 regular
248 250 +regular
249 251 diff -r a66d19b9302d rmbinary
250 252 Binary file rmbinary has changed
251 253 diff -r a66d19b9302d rmexec
252 254 --- a/rmexec
253 255 +++ /dev/null
254 256 @@ -1,1 +0,0 @@
255 257 -rmexec
256 258 diff -r a66d19b9302d rmregular
257 259 --- a/rmregular
258 260 +++ /dev/null
259 261 @@ -1,1 +0,0 @@
260 262 -rmregular
261 263 data lost for: binary
262 264 data lost for: bintoregular
263 265 data lost for: newbinary
264 266 data lost for: newempty
265 267 data lost for: newexec
266 268 data lost for: rmbinary
267 269 data lost for: rmempty
268 270 data lost for: setexec
269 271 data lost for: unsetexec
270 272
271 273 git=abort: fail on execute bit change
272 274
273 275 $ hg autodiff --git=abort regular setexec
274 276 abort: losing data for setexec
275 277 [255]
276 278
277 279 git=abort: succeed on regular file
278 280
279 281 $ hg autodiff --git=abort regular
280 282 diff -r a66d19b9302d regular
281 283 --- a/regular
282 284 +++ b/regular
283 285 @@ -1,1 +1,2 @@
284 286 regular
285 287 +regular
286 288
287 289 $ cd ..
288 290
@@ -1,543 +1,545 b''
1 1 Test EOL extension
2 2
3 3 $ cat >> $HGRCPATH <<EOF
4 4 > [diff]
5 5 > git = True
6 6 > EOF
7 7
8 8 Set up helpers
9 9
10 10 $ cat > switch-eol.py <<EOF
11 11 > import sys
12 12 > try:
13 13 > import os, msvcrt
14 14 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
15 15 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
16 16 > except ImportError:
17 17 > pass
18 18 > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n')
19 19 > print "%% switching encoding from %r to %r" % (old, new)
20 20 > for path in sys.argv[2:]:
21 21 > data = file(path, 'rb').read()
22 22 > data = data.replace(old, new)
23 23 > file(path, 'wb').write(data)
24 24 > EOF
25 25
26 26 $ seteol () {
27 27 > if [ $1 = "LF" ]; then
28 28 > EOL='\n'
29 29 > else
30 30 > EOL='\r\n'
31 31 > fi
32 32 > }
33 33
34 34 $ makerepo () {
35 35 > seteol $1
36 36 > echo "% setup $1 repository"
37 37 > hg init repo
38 38 > cd repo
39 39 > cat > .hgeol <<EOF
40 40 > [repository]
41 41 > native = $1
42 42 > [patterns]
43 43 > mixed.txt = BIN
44 44 > **.txt = native
45 45 > EOF
46 46 > printf "first${EOL}second${EOL}third${EOL}" > a.txt
47 47 > hg commit --addremove -m 'checkin'
48 48 > echo
49 49 > cd ..
50 50 > }
51 51
52 52 $ dotest () {
53 53 > seteol $1
54 54 > echo "% hg clone repo repo-$1"
55 55 > hg clone --noupdate repo repo-$1
56 56 > cd repo-$1
57 57 > cat > .hg/hgrc <<EOF
58 58 > [extensions]
59 59 > eol =
60 60 > [eol]
61 61 > native = $1
62 62 > EOF
63 63 > hg update
64 64 > echo '% a.txt'
65 65 > cat a.txt
66 66 > echo '% hg cat a.txt'
67 67 > hg cat a.txt
68 68 > printf "fourth${EOL}" >> a.txt
69 69 > echo '% a.txt'
70 70 > cat a.txt
71 71 > hg diff
72 72 > python ../switch-eol.py $1 a.txt
73 73 > echo '% hg diff only reports a single changed line:'
74 74 > hg diff
75 75 > echo "% reverting back to $1 format"
76 76 > hg revert a.txt
77 77 > cat a.txt
78 78 > printf "first\r\nsecond\n" > mixed.txt
79 79 > hg add mixed.txt
80 80 > echo "% hg commit of inconsistent .txt file marked as binary (should work)"
81 81 > hg commit -m 'binary file'
82 82 > echo "% hg commit of inconsistent .txt file marked as native (should fail)"
83 83 > printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt
84 84 > hg commit -m 'inconsistent file'
85 85 > echo "% hg commit --config eol.only-consistent=False (should work)"
86 86 > hg commit --config eol.only-consistent=False -m 'inconsistent file'
87 87 > echo "% hg commit of binary .txt file marked as native (binary files always okay)"
88 88 > printf "first${EOL}\0${EOL}third${EOL}" > a.txt
89 89 > hg commit -m 'binary file'
90 90 > cd ..
91 91 > rm -r repo-$1
92 92 > }
93 93
94 94 $ makemixedrepo () {
95 95 > echo
96 96 > echo "# setup $1 repository"
97 97 > hg init mixed
98 98 > cd mixed
99 99 > printf "foo\r\nbar\r\nbaz\r\n" > win.txt
100 100 > printf "foo\nbar\nbaz\n" > unix.txt
101 101 > #printf "foo\r\nbar\nbaz\r\n" > mixed.txt
102 102 > hg commit --addremove -m 'created mixed files'
103 103 > echo "# setting repository-native EOLs to $1"
104 104 > cat > .hgeol <<EOF
105 105 > [repository]
106 106 > native = $1
107 107 > [patterns]
108 108 > **.txt = native
109 109 > EOF
110 110 > hg commit --addremove -m 'added .hgeol'
111 111 > cd ..
112 112 > }
113 113
114 114 $ testmixed () {
115 115 > echo
116 116 > echo "% hg clone mixed mixed-$1"
117 117 > hg clone mixed mixed-$1
118 118 > cd mixed-$1
119 119 > echo '% hg status (eol extension not yet activated)'
120 120 > hg status
121 121 > cat > .hg/hgrc <<EOF
122 122 > [extensions]
123 123 > eol =
124 124 > [eol]
125 125 > native = $1
126 126 > EOF
127 127 > echo '% hg status (eol activated)'
128 128 > hg status
129 129 > echo '% hg commit'
130 130 > hg commit -m 'synchronized EOLs'
131 131 > echo '% hg status'
132 132 > hg status
133 133 > cd ..
134 134 > rm -r mixed-$1
135 135 > }
136 136
137 137 Basic tests
138 138
139 139 $ makerepo LF
140 140 % setup LF repository
141 141 adding .hgeol
142 142 adding a.txt
143 143
144 144 $ dotest LF
145 145 % hg clone repo repo-LF
146 146 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
147 147 % a.txt
148 148 first
149 149 second
150 150 third
151 151 % hg cat a.txt
152 152 first
153 153 second
154 154 third
155 155 % a.txt
156 156 first
157 157 second
158 158 third
159 159 fourth
160 160 diff --git a/a.txt b/a.txt
161 161 --- a/a.txt
162 162 +++ b/a.txt
163 163 @@ -1,3 +1,4 @@
164 164 first
165 165 second
166 166 third
167 167 +fourth
168 168 % switching encoding from '\n' to '\r\n'
169 169 % hg diff only reports a single changed line:
170 170 diff --git a/a.txt b/a.txt
171 171 --- a/a.txt
172 172 +++ b/a.txt
173 173 @@ -1,3 +1,4 @@
174 174 first
175 175 second
176 176 third
177 177 +fourth
178 178 % reverting back to LF format
179 179 first
180 180 second
181 181 third
182 182 % hg commit of inconsistent .txt file marked as binary (should work)
183 183 % hg commit of inconsistent .txt file marked as native (should fail)
184 184 abort: inconsistent newline style in a.txt
185 185
186 186 % hg commit --config eol.only-consistent=False (should work)
187 187 % hg commit of binary .txt file marked as native (binary files always okay)
188 188 $ dotest CRLF
189 189 % hg clone repo repo-CRLF
190 190 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 191 % a.txt
192 192 first\r (esc)
193 193 second\r (esc)
194 194 third\r (esc)
195 195 % hg cat a.txt
196 196 first
197 197 second
198 198 third
199 199 % a.txt
200 200 first\r (esc)
201 201 second\r (esc)
202 202 third\r (esc)
203 203 fourth\r (esc)
204 204 diff --git a/a.txt b/a.txt
205 205 --- a/a.txt
206 206 +++ b/a.txt
207 207 @@ -1,3 +1,4 @@
208 208 first
209 209 second
210 210 third
211 211 +fourth
212 212 % switching encoding from '\r\n' to '\n'
213 213 % hg diff only reports a single changed line:
214 214 diff --git a/a.txt b/a.txt
215 215 --- a/a.txt
216 216 +++ b/a.txt
217 217 @@ -1,3 +1,4 @@
218 218 first
219 219 second
220 220 third
221 221 +fourth
222 222 % reverting back to CRLF format
223 223 first\r (esc)
224 224 second\r (esc)
225 225 third\r (esc)
226 226 % hg commit of inconsistent .txt file marked as binary (should work)
227 227 % hg commit of inconsistent .txt file marked as native (should fail)
228 228 abort: inconsistent newline style in a.txt
229 229
230 230 % hg commit --config eol.only-consistent=False (should work)
231 231 % hg commit of binary .txt file marked as native (binary files always okay)
232 232 $ rm -r repo
233 233 $ makerepo CRLF
234 234 % setup CRLF repository
235 235 adding .hgeol
236 236 adding a.txt
237 237
238 238 $ dotest LF
239 239 % hg clone repo repo-LF
240 240 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
241 241 % a.txt
242 242 first
243 243 second
244 244 third
245 245 % hg cat a.txt
246 246 first\r (esc)
247 247 second\r (esc)
248 248 third\r (esc)
249 249 % a.txt
250 250 first
251 251 second
252 252 third
253 253 fourth
254 254 diff --git a/a.txt b/a.txt
255 255 --- a/a.txt
256 256 +++ b/a.txt
257 257 @@ -1,3 +1,4 @@
258 258 first\r (esc)
259 259 second\r (esc)
260 260 third\r (esc)
261 261 +fourth\r (esc)
262 262 % switching encoding from '\n' to '\r\n'
263 263 % hg diff only reports a single changed line:
264 264 diff --git a/a.txt b/a.txt
265 265 --- a/a.txt
266 266 +++ b/a.txt
267 267 @@ -1,3 +1,4 @@
268 268 first\r (esc)
269 269 second\r (esc)
270 270 third\r (esc)
271 271 +fourth\r (esc)
272 272 % reverting back to LF format
273 273 first
274 274 second
275 275 third
276 276 % hg commit of inconsistent .txt file marked as binary (should work)
277 277 % hg commit of inconsistent .txt file marked as native (should fail)
278 278 abort: inconsistent newline style in a.txt
279 279
280 280 % hg commit --config eol.only-consistent=False (should work)
281 281 % hg commit of binary .txt file marked as native (binary files always okay)
282 282 $ dotest CRLF
283 283 % hg clone repo repo-CRLF
284 284 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
285 285 % a.txt
286 286 first\r (esc)
287 287 second\r (esc)
288 288 third\r (esc)
289 289 % hg cat a.txt
290 290 first\r (esc)
291 291 second\r (esc)
292 292 third\r (esc)
293 293 % a.txt
294 294 first\r (esc)
295 295 second\r (esc)
296 296 third\r (esc)
297 297 fourth\r (esc)
298 298 diff --git a/a.txt b/a.txt
299 299 --- a/a.txt
300 300 +++ b/a.txt
301 301 @@ -1,3 +1,4 @@
302 302 first\r (esc)
303 303 second\r (esc)
304 304 third\r (esc)
305 305 +fourth\r (esc)
306 306 % switching encoding from '\r\n' to '\n'
307 307 % hg diff only reports a single changed line:
308 308 diff --git a/a.txt b/a.txt
309 309 --- a/a.txt
310 310 +++ b/a.txt
311 311 @@ -1,3 +1,4 @@
312 312 first\r (esc)
313 313 second\r (esc)
314 314 third\r (esc)
315 315 +fourth\r (esc)
316 316 % reverting back to CRLF format
317 317 first\r (esc)
318 318 second\r (esc)
319 319 third\r (esc)
320 320 % hg commit of inconsistent .txt file marked as binary (should work)
321 321 % hg commit of inconsistent .txt file marked as native (should fail)
322 322 abort: inconsistent newline style in a.txt
323 323
324 324 % hg commit --config eol.only-consistent=False (should work)
325 325 % hg commit of binary .txt file marked as native (binary files always okay)
326 326 $ rm -r repo
327 327
328 328 Mixed tests
329 329
330 330 $ makemixedrepo LF
331 331
332 332 # setup LF repository
333 333 adding unix.txt
334 334 adding win.txt
335 335 # setting repository-native EOLs to LF
336 336 adding .hgeol
337 337 $ testmixed LF
338 338
339 339 % hg clone mixed mixed-LF
340 340 updating to branch default
341 341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
342 342 % hg status (eol extension not yet activated)
343 343 % hg status (eol activated)
344 344 M win.txt
345 345 % hg commit
346 346 % hg status
347 347 $ testmixed CRLF
348 348
349 349 % hg clone mixed mixed-CRLF
350 350 updating to branch default
351 351 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 352 % hg status (eol extension not yet activated)
353 353 % hg status (eol activated)
354 354 M win.txt
355 355 % hg commit
356 356 % hg status
357 357 $ rm -r mixed
358 358 $ makemixedrepo CRLF
359 359
360 360 # setup CRLF repository
361 361 adding unix.txt
362 362 adding win.txt
363 363 # setting repository-native EOLs to CRLF
364 364 adding .hgeol
365 365 $ testmixed LF
366 366
367 367 % hg clone mixed mixed-LF
368 368 updating to branch default
369 369 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 370 % hg status (eol extension not yet activated)
371 371 % hg status (eol activated)
372 372 M unix.txt
373 373 % hg commit
374 374 % hg status
375 375 $ testmixed CRLF
376 376
377 377 % hg clone mixed mixed-CRLF
378 378 updating to branch default
379 379 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 380 % hg status (eol extension not yet activated)
381 381 % hg status (eol activated)
382 382 M unix.txt
383 383 % hg commit
384 384 % hg status
385 385 $ rm -r mixed
386 386
387 387 $ echo '[extensions]' >> $HGRCPATH
388 388 $ echo 'eol =' >> $HGRCPATH
389 389
390 390 #if unix-permissions
391 391
392 392 Test issue2569 -- eol extension takes write lock on reading:
393 393
394 394 $ hg init repo
395 395 $ cd repo
396 396 $ touch .hgeol
397 397 $ hg status
398 398 ? .hgeol
399 399 $ chmod -R -w .hg
400 400 $ sleep 1
401 401 $ touch .hgeol
402 402 $ hg status --traceback
403 403 ? .hgeol
404 404 $ chmod -R u+w .hg
405 405 $ cd ..
406 406
407 407 #endif
408 408
409 409 Test cleverencode: and cleverdecode: aliases for win32text extension
410 410
411 $ echo '[encode]' >> $HGRCPATH
412 $ echo '**.txt = cleverencode:' >> $HGRCPATH
413 $ echo '[decode]' >> $HGRCPATH
414 $ echo '**.txt = cleverdecode:' >> $HGRCPATH
411 $ cat <<EOF >> $HGRCPATH
412 > [encode]
413 > **.txt = cleverencode:
414 > [decode]
415 > **.txt = cleverdecode:
416 > EOF
415 417
416 418 $ hg init win32compat
417 419 $ cd win32compat
418 420 $ printf "foo\r\nbar\r\nbaz\r\n" > win.txt
419 421 $ printf "foo\nbar\nbaz\n" > unix.txt
420 422 $ hg add
421 423 adding unix.txt
422 424 adding win.txt
423 425 $ hg commit -m checkin
424 426
425 427 Check that both files have LF line-endings in the repository:
426 428
427 429 $ hg cat win.txt
428 430 foo
429 431 bar
430 432 baz
431 433 $ hg cat unix.txt
432 434 foo
433 435 bar
434 436 baz
435 437
436 438 Test handling of a broken .hgeol file:
437 439
438 440 $ touch .hgeol
439 441 $ hg add .hgeol
440 442 $ hg commit -m 'clean version'
441 443 $ echo "bad" > .hgeol
442 444 $ hg status
443 445 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
444 446 M .hgeol
445 447 $ hg revert .hgeol
446 448 warning: ignoring .hgeol file due to parse error at .hgeol:1: bad
447 449 $ hg status
448 450 ? .hgeol.orig
449 451
450 452 Test eol.only-consistent can be specified in .hgeol
451 453
452 454 $ cd $TESTTMP
453 455 $ hg init only-consistent
454 456 $ cd only-consistent
455 457 $ printf "first\nsecond\r\n" > a.txt
456 458 $ hg add a.txt
457 459 $ cat > .hgeol << EOF
458 460 > [eol]
459 461 > only-consistent = True
460 462 > EOF
461 463 $ hg commit -m 'inconsistent'
462 464 abort: inconsistent newline style in a.txt
463 465
464 466 [255]
465 467 $ cat > .hgeol << EOF
466 468 > [eol]
467 469 > only-consistent = False
468 470 > EOF
469 471 $ hg commit -m 'consistent'
470 472
471 473
472 474 Test trailing newline
473 475
474 476 $ cat >> $HGRCPATH <<EOF
475 477 > [extensions]
476 478 > eol=
477 479 > EOF
478 480
479 481 setup repository
480 482
481 483 $ cd $TESTTMP
482 484 $ hg init trailing
483 485 $ cd trailing
484 486 $ cat > .hgeol <<EOF
485 487 > [patterns]
486 488 > **.txt = native
487 489 > [eol]
488 490 > fix-trailing-newline = False
489 491 > EOF
490 492
491 493 add text without trailing newline
492 494
493 495 $ printf "first\nsecond" > a.txt
494 496 $ hg commit --addremove -m 'checking in'
495 497 adding .hgeol
496 498 adding a.txt
497 499 $ rm a.txt
498 500 $ hg update -C -q
499 501 $ cat a.txt
500 502 first
501 503 second (no-eol)
502 504
503 505 $ cat > .hgeol <<EOF
504 506 > [patterns]
505 507 > **.txt = native
506 508 > [eol]
507 509 > fix-trailing-newline = True
508 510 > EOF
509 511 $ printf "third\nfourth" > a.txt
510 512 $ hg commit -m 'checking in with newline fix'
511 513 $ rm a.txt
512 514 $ hg update -C -q
513 515 $ cat a.txt
514 516 third
515 517 fourth
516 518
517 519 append a line without trailing newline
518 520
519 521 $ printf "fifth" >> a.txt
520 522 $ hg commit -m 'adding another line line'
521 523 $ rm a.txt
522 524 $ hg update -C -q
523 525 $ cat a.txt
524 526 third
525 527 fourth
526 528 fifth
527 529
528 530 amend of changesets with renamed/deleted files expose new code paths
529 531
530 532 $ hg mv a.txt b.txt
531 533 $ hg ci --amend -q
532 534 $ hg diff -c.
533 535 diff --git a/a.txt b/b.txt
534 536 rename from a.txt
535 537 rename to b.txt
536 538 --- a/a.txt
537 539 +++ b/b.txt
538 540 @@ -1,2 +1,3 @@
539 541 third
540 542 fourth
541 543 +fifth
542 544
543 545 $ cd ..
@@ -1,76 +1,78 b''
1 1 #require eol-in-paths
2 2
3 3 http://mercurial.selenic.com/bts/issue352
4 4
5 5 test issue352
6 6
7 7 $ hg init foo
8 8 $ cd foo
9 9 $ A=`printf 'he\rllo'`
10 10 $ echo foo > "$A"
11 11 $ hg add
12 12 adding he\r (no-eol) (esc)
13 13 llo
14 14 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
15 15 [255]
16 16 $ hg ci -A -m m
17 17 adding he\r (no-eol) (esc)
18 18 llo
19 19 abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
20 20 [255]
21 21 $ rm "$A"
22 22 $ echo foo > "hell
23 23 > o"
24 24 $ hg add
25 25 adding hell
26 26 o
27 27 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
28 28 [255]
29 29 $ hg ci -A -m m
30 30 adding hell
31 31 o
32 32 abort: '\n' and '\r' disallowed in filenames: 'hell\no'
33 33 [255]
34 34 $ echo foo > "$A"
35 35 $ hg debugwalk
36 36 f he\r (no-eol) (esc)
37 37 llo he\r (no-eol) (esc)
38 38 llo
39 39 f hell
40 40 o hell
41 41 o
42 42
43 43 $ echo bla > quickfox
44 44 $ hg add quickfox
45 45 $ hg ci -m 2
46 46 $ A=`printf 'quick\rfox'`
47 47 $ hg cp quickfox "$A"
48 48 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
49 49 [255]
50 50 $ hg mv quickfox "$A"
51 51 abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
52 52 [255]
53 53
54 54 http://mercurial.selenic.com/bts/issue2036
55 55
56 56 $ cd ..
57 57
58 58 test issue2039
59 59
60 60 $ hg init bar
61 61 $ cd bar
62 $ echo "[extensions]" >> $HGRCPATH
63 $ echo "color=" >> $HGRCPATH
64 $ echo "[color]" >> $HGRCPATH
65 $ echo "mode = ansi" >> $HGRCPATH
62 $ cat <<EOF >> $HGRCPATH
63 > [extensions]
64 > color =
65 > [color]
66 > mode = ansi
67 > EOF
66 68 $ A=`printf 'foo\nbar'`
67 69 $ B=`printf 'foo\nbar.baz'`
68 70 $ touch "$A"
69 71 $ touch "$B"
70 72 $ hg status --color=always
71 73 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mfoo\x1b[0m (esc)
72 74 \x1b[0;35;1;4mbar\x1b[0m (esc)
73 75 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mfoo\x1b[0m (esc)
74 76 \x1b[0;35;1;4mbar.baz\x1b[0m (esc)
75 77
76 78 $ cd ..
@@ -1,203 +1,205 b''
1 1 $ hg init repo
2 2 $ cd repo
3 3 $ touch foo
4 4 $ hg add foo
5 5 $ for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
6 6 > echo "foo-$i" >> foo
7 7 > hg ci -m "foo-$i"
8 8 > done
9 9
10 10 $ for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r" "%m"; do
11 11 > echo
12 12 > echo "# foo-$out.patch"
13 13 > hg export -v -o "foo-$out.patch" 2:tip
14 14 > done
15 15
16 16 # foo-%nof%N.patch
17 17 exporting patches:
18 18 foo-01of10.patch
19 19 foo-02of10.patch
20 20 foo-03of10.patch
21 21 foo-04of10.patch
22 22 foo-05of10.patch
23 23 foo-06of10.patch
24 24 foo-07of10.patch
25 25 foo-08of10.patch
26 26 foo-09of10.patch
27 27 foo-10of10.patch
28 28
29 29 # foo-%%%H.patch
30 30 exporting patches:
31 31 foo-%617188a1c80f869a7b66c85134da88a6fb145f67.patch
32 32 foo-%dd41a5ff707a5225204105611ba49cc5c229d55f.patch
33 33 foo-%f95a5410f8664b6e1490a4af654e4b7d41a7b321.patch
34 34 foo-%4346bcfde53b4d9042489078bcfa9c3e28201db2.patch
35 35 foo-%afda8c3a009cc99449a05ad8aa4655648c4ecd34.patch
36 36 foo-%35284ce2b6b99c9d2ac66268fe99e68e1974e1aa.patch
37 37 foo-%9688c41894e6931305fa7165a37f6568050b4e9b.patch
38 38 foo-%747d3c68f8ec44bb35816bfcd59aeb50b9654c2f.patch
39 39 foo-%5f17a83f5fbd9414006a5e563eab4c8a00729efd.patch
40 40 foo-%f3acbafac161ec68f1598af38f794f28847ca5d3.patch
41 41
42 42 # foo-%b-%R.patch
43 43 exporting patches:
44 44 foo-repo-2.patch
45 45 foo-repo-3.patch
46 46 foo-repo-4.patch
47 47 foo-repo-5.patch
48 48 foo-repo-6.patch
49 49 foo-repo-7.patch
50 50 foo-repo-8.patch
51 51 foo-repo-9.patch
52 52 foo-repo-10.patch
53 53 foo-repo-11.patch
54 54
55 55 # foo-%h.patch
56 56 exporting patches:
57 57 foo-617188a1c80f.patch
58 58 foo-dd41a5ff707a.patch
59 59 foo-f95a5410f866.patch
60 60 foo-4346bcfde53b.patch
61 61 foo-afda8c3a009c.patch
62 62 foo-35284ce2b6b9.patch
63 63 foo-9688c41894e6.patch
64 64 foo-747d3c68f8ec.patch
65 65 foo-5f17a83f5fbd.patch
66 66 foo-f3acbafac161.patch
67 67
68 68 # foo-%r.patch
69 69 exporting patches:
70 70 foo-02.patch
71 71 foo-03.patch
72 72 foo-04.patch
73 73 foo-05.patch
74 74 foo-06.patch
75 75 foo-07.patch
76 76 foo-08.patch
77 77 foo-09.patch
78 78 foo-10.patch
79 79 foo-11.patch
80 80
81 81 # foo-%m.patch
82 82 exporting patches:
83 83 foo-foo_2.patch
84 84 foo-foo_3.patch
85 85 foo-foo_4.patch
86 86 foo-foo_5.patch
87 87 foo-foo_6.patch
88 88 foo-foo_7.patch
89 89 foo-foo_8.patch
90 90 foo-foo_9.patch
91 91 foo-foo_10.patch
92 92 foo-foo_11.patch
93 93
94 94 Doing it again clobbers the files rather than appending:
95 95 $ hg export -v -o "foo-%m.patch" 2:3
96 96 exporting patches:
97 97 foo-foo_2.patch
98 98 foo-foo_3.patch
99 99 $ grep HG foo-foo_2.patch | wc -l
100 100 \s*1 (re)
101 101 $ grep HG foo-foo_3.patch | wc -l
102 102 \s*1 (re)
103 103
104 104 Exporting 4 changesets to a file:
105 105
106 106 $ hg export -o export_internal 1 2 3 4
107 107 $ grep HG export_internal | wc -l
108 108 \s*4 (re)
109 109
110 110 Doing it again clobbers the file rather than appending:
111 111 $ hg export -o export_internal 1 2 3 4
112 112 $ grep HG export_internal | wc -l
113 113 \s*4 (re)
114 114
115 115 Exporting 4 changesets to stdout:
116 116
117 117 $ hg export 1 2 3 4 | grep HG | wc -l
118 118 \s*4 (re)
119 119
120 120 Exporting revision -2 to a file:
121 121
122 122 $ hg export -- -2
123 123 # HG changeset patch
124 124 # User test
125 125 # Date 0 0
126 126 # Thu Jan 01 00:00:00 1970 +0000
127 127 # Node ID 5f17a83f5fbd9414006a5e563eab4c8a00729efd
128 128 # Parent 747d3c68f8ec44bb35816bfcd59aeb50b9654c2f
129 129 foo-10
130 130
131 131 diff -r 747d3c68f8ec -r 5f17a83f5fbd foo
132 132 --- a/foo Thu Jan 01 00:00:00 1970 +0000
133 133 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
134 134 @@ -8,3 +8,4 @@
135 135 foo-7
136 136 foo-8
137 137 foo-9
138 138 +foo-10
139 139
140 140 Checking if only alphanumeric characters are used in the file name (%m option):
141 141
142 142 $ echo "line" >> foo
143 143 $ hg commit -m " !\"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~"
144 144 $ hg export -v -o %m.patch tip
145 145 exporting patch:
146 146 ____________0123456789_______ABCDEFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz____.patch
147 147
148 148 Catch exporting unknown revisions (especially empty revsets, see issue3353)
149 149
150 150 $ hg export
151 151 # HG changeset patch
152 152 # User test
153 153 # Date 0 0
154 154 # Thu Jan 01 00:00:00 1970 +0000
155 155 # Node ID 197ecd81a57f760b54f34a58817ad5b04991fa47
156 156 # Parent f3acbafac161ec68f1598af38f794f28847ca5d3
157 157 !"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
158 158
159 159 diff -r f3acbafac161 -r 197ecd81a57f foo
160 160 --- a/foo Thu Jan 01 00:00:00 1970 +0000
161 161 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
162 162 @@ -10,3 +10,4 @@
163 163 foo-9
164 164 foo-10
165 165 foo-11
166 166 +line
167 167
168 168 $ hg export ""
169 169 hg: parse error: empty query
170 170 [255]
171 171 $ hg export 999
172 172 abort: unknown revision '999'!
173 173 [255]
174 174 $ hg export "not all()"
175 175 abort: export requires at least one changeset
176 176 [255]
177 177
178 178 Check for color output
179 $ echo "[color]" >> $HGRCPATH
180 $ echo "mode = ansi" >> $HGRCPATH
181 $ echo "[extensions]" >> $HGRCPATH
182 $ echo "color=" >> $HGRCPATH
179 $ cat <<EOF >> $HGRCPATH
180 > [color]
181 > mode = ansi
182 > [extensions]
183 > color =
184 > EOF
183 185
184 186 $ hg export --color always --nodates tip
185 187 # HG changeset patch
186 188 # User test
187 189 # Date 0 0
188 190 # Thu Jan 01 00:00:00 1970 +0000
189 191 # Node ID * (glob)
190 192 # Parent * (glob)
191 193 !"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
192 194
193 195 \x1b[0;1mdiff -r f3acbafac161 -r 197ecd81a57f foo\x1b[0m (esc)
194 196 \x1b[0;31;1m--- a/foo\x1b[0m (esc)
195 197 \x1b[0;32;1m+++ b/foo\x1b[0m (esc)
196 198 \x1b[0;35m@@ -10,3 +10,4 @@\x1b[0m (esc)
197 199 foo-9
198 200 foo-10
199 201 foo-11
200 202 \x1b[0;32m+line\x1b[0m (esc)
201 203
202 204
203 205 $ cd ..
@@ -1,234 +1,236 b''
1 1 $ echo "[extensions]" >> $HGRCPATH
2 2 $ echo "extdiff=" >> $HGRCPATH
3 3
4 4 $ hg init a
5 5 $ cd a
6 6 $ echo a > a
7 7 $ echo b > b
8 8 $ hg add
9 9 adding a
10 10 adding b
11 11
12 12 Should diff cloned directories:
13 13
14 14 $ hg extdiff -o -r $opt
15 15 Only in a: a
16 16 Only in a: b
17 17 [1]
18 18
19 $ echo "[extdiff]" >> $HGRCPATH
20 $ echo "cmd.falabala=echo" >> $HGRCPATH
21 $ echo "opts.falabala=diffing" >> $HGRCPATH
22 $ echo "cmd.edspace=echo" >> $HGRCPATH
23 $ echo 'opts.edspace="name <user@example.com>"' >> $HGRCPATH
19 $ cat <<EOF >> $HGRCPATH
20 > [extdiff]
21 > cmd.falabala = echo
22 > opts.falabala = diffing
23 > cmd.edspace = echo
24 > opts.edspace = "name <user@example.com>"
25 > EOF
24 26
25 27 $ hg falabala
26 28 diffing a.000000000000 a
27 29 [1]
28 30
29 31 $ hg help falabala
30 32 hg falabala [OPTION]... [FILE]...
31 33
32 34 use 'echo' to diff repository (or selected files)
33 35
34 36 Show differences between revisions for the specified files, using the
35 37 'echo' program.
36 38
37 39 When two revision arguments are given, then changes are shown between
38 40 those revisions. If only one revision is specified then that revision is
39 41 compared to the working directory, and, when no revisions are specified,
40 42 the working directory files are compared to its parent.
41 43
42 44 options ([+] can be repeated):
43 45
44 46 -o --option OPT [+] pass option to comparison program
45 47 -r --rev REV [+] revision
46 48 -c --change REV change made by revision
47 49 -I --include PATTERN [+] include names matching the given patterns
48 50 -X --exclude PATTERN [+] exclude names matching the given patterns
49 51
50 52 (some details hidden, use --verbose to show complete help)
51 53
52 54 $ hg ci -d '0 0' -mtest1
53 55
54 56 $ echo b >> a
55 57 $ hg ci -d '1 0' -mtest2
56 58
57 59 Should diff cloned files directly:
58 60
59 61 $ hg falabala -r 0:1
60 62 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
61 63 [1]
62 64
63 65 Test diff during merge:
64 66
65 67 $ hg update -C 0
66 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 69 $ echo c >> c
68 70 $ hg add c
69 71 $ hg ci -m "new branch" -d '1 0'
70 72 created new head
71 73 $ hg merge 1
72 74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 75 (branch merge, don't forget to commit)
74 76
75 77 Should diff cloned file against wc file:
76 78
77 79 $ hg falabala
78 80 diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
79 81 [1]
80 82
81 83
82 84 Test --change option:
83 85
84 86 $ hg ci -d '2 0' -mtest3
85 87 $ hg falabala -c 1
86 88 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
87 89 [1]
88 90
89 91 Check diff are made from the first parent:
90 92
91 93 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
92 94 diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
93 95 diff-like tools yield a non-zero exit code
94 96
95 97 #if execbit
96 98
97 99 Test extdiff of multiple files in tmp dir:
98 100
99 101 $ hg update -C 0 > /dev/null
100 102 $ echo changed > a
101 103 $ echo changed > b
102 104 $ chmod +x b
103 105
104 106 Diff in working directory, before:
105 107
106 108 $ hg diff --git
107 109 diff --git a/a b/a
108 110 --- a/a
109 111 +++ b/a
110 112 @@ -1,1 +1,1 @@
111 113 -a
112 114 +changed
113 115 diff --git a/b b/b
114 116 old mode 100644
115 117 new mode 100755
116 118 --- a/b
117 119 +++ b/b
118 120 @@ -1,1 +1,1 @@
119 121 -b
120 122 +changed
121 123
122 124
123 125 Edit with extdiff -p:
124 126
125 127 Prepare custom diff/edit tool:
126 128
127 129 $ cat > 'diff tool.py' << EOT
128 130 > #!/usr/bin/env python
129 131 > import time
130 132 > time.sleep(1) # avoid unchanged-timestamp problems
131 133 > file('a/a', 'ab').write('edited\n')
132 134 > file('a/b', 'ab').write('edited\n')
133 135 > EOT
134 136
135 137 $ chmod +x 'diff tool.py'
136 138
137 139 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
138 140 and start tool
139 141
140 142 $ hg extdiff -p "`pwd`/diff tool.py"
141 143 [1]
142 144
143 145 Diff in working directory, after:
144 146
145 147 $ hg diff --git
146 148 diff --git a/a b/a
147 149 --- a/a
148 150 +++ b/a
149 151 @@ -1,1 +1,2 @@
150 152 -a
151 153 +changed
152 154 +edited
153 155 diff --git a/b b/b
154 156 old mode 100644
155 157 new mode 100755
156 158 --- a/b
157 159 +++ b/b
158 160 @@ -1,1 +1,2 @@
159 161 -b
160 162 +changed
161 163 +edited
162 164
163 165 Test extdiff with --option:
164 166
165 167 $ hg extdiff -p echo -o this -c 1
166 168 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
167 169 [1]
168 170
169 171 $ hg falabala -o this -c 1
170 172 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
171 173 [1]
172 174
173 175 Test extdiff's handling of options with spaces in them:
174 176
175 177 $ hg edspace -c 1
176 178 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
177 179 [1]
178 180
179 181 $ hg extdiff -p echo -o "name <user@example.com>" -c 1
180 182 name <user@example.com> */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
181 183 [1]
182 184
183 185 Test with revsets:
184 186
185 187 $ hg extdif -p echo -c "rev(1)"
186 188 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
187 189 [1]
188 190
189 191 $ hg extdif -p echo -r "0::1"
190 192 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
191 193 [1]
192 194
193 195 Fallback to merge-tools.tool.executable|regkey
194 196 $ mkdir dir
195 197 $ cat > 'dir/tool.sh' << EOF
196 198 > #!/bin/sh
197 199 > echo "** custom diff **"
198 200 > EOF
199 201 $ chmod +x dir/tool.sh
200 202 $ tool=`pwd`/dir/tool.sh
201 203 $ hg --debug tl --config extdiff.tl= --config merge-tools.tl.executable=$tool
202 204 making snapshot of 2 files from rev * (glob)
203 205 a
204 206 b
205 207 making snapshot of 2 files from working directory
206 208 a
207 209 b
208 210 running "'$TESTTMP/a/dir/tool.sh' 'a.*' 'a'" in */extdiff.* (glob)
209 211 ** custom diff **
210 212 cleaning up temp directory
211 213 [1]
212 214
213 215 $ cd ..
214 216
215 217 #endif
216 218
217 219 #if symlink
218 220
219 221 Test symlinks handling (issue1909)
220 222
221 223 $ hg init testsymlinks
222 224 $ cd testsymlinks
223 225 $ echo a > a
224 226 $ hg ci -Am adda
225 227 adding a
226 228 $ echo a >> a
227 229 $ ln -s missing linka
228 230 $ hg add linka
229 231 $ hg falabala -r 0 --traceback
230 232 diffing testsymlinks.07f494440405 testsymlinks
231 233 [1]
232 234 $ cd ..
233 235
234 236 #endif
@@ -1,909 +1,917 b''
1 1 Test basic extension support
2 2
3 3 $ cat > foobar.py <<EOF
4 4 > import os
5 5 > from mercurial import cmdutil, commands
6 6 > cmdtable = {}
7 7 > command = cmdutil.command(cmdtable)
8 8 > def uisetup(ui):
9 9 > ui.write("uisetup called\\n")
10 10 > def reposetup(ui, repo):
11 11 > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
12 12 > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
13 13 > @command('foo', [], 'hg foo')
14 14 > def foo(ui, *args, **kwargs):
15 15 > ui.write("Foo\\n")
16 16 > @command('bar', [], 'hg bar', norepo=True)
17 17 > def bar(ui, *args, **kwargs):
18 18 > ui.write("Bar\\n")
19 19 > EOF
20 20 $ abspath=`pwd`/foobar.py
21 21
22 22 $ mkdir barfoo
23 23 $ cp foobar.py barfoo/__init__.py
24 24 $ barfoopath=`pwd`/barfoo
25 25
26 26 $ hg init a
27 27 $ cd a
28 28 $ echo foo > file
29 29 $ hg add file
30 30 $ hg commit -m 'add file'
31 31
32 32 $ echo '[extensions]' >> $HGRCPATH
33 33 $ echo "foobar = $abspath" >> $HGRCPATH
34 34 $ hg foo
35 35 uisetup called
36 36 reposetup called for a
37 37 ui == repo.ui
38 38 Foo
39 39
40 40 $ cd ..
41 41 $ hg clone a b
42 42 uisetup called
43 43 reposetup called for a
44 44 ui == repo.ui
45 45 reposetup called for b
46 46 ui == repo.ui
47 47 updating to branch default
48 48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 49
50 50 $ hg bar
51 51 uisetup called
52 52 Bar
53 53 $ echo 'foobar = !' >> $HGRCPATH
54 54
55 55 module/__init__.py-style
56 56
57 57 $ echo "barfoo = $barfoopath" >> $HGRCPATH
58 58 $ cd a
59 59 $ hg foo
60 60 uisetup called
61 61 reposetup called for a
62 62 ui == repo.ui
63 63 Foo
64 64 $ echo 'barfoo = !' >> $HGRCPATH
65 65
66 66 Check that extensions are loaded in phases:
67 67
68 68 $ cat > foo.py <<EOF
69 69 > import os
70 70 > name = os.path.basename(__file__).rsplit('.', 1)[0]
71 71 > print "1) %s imported" % name
72 72 > def uisetup(ui):
73 73 > print "2) %s uisetup" % name
74 74 > def extsetup():
75 75 > print "3) %s extsetup" % name
76 76 > def reposetup(ui, repo):
77 77 > print "4) %s reposetup" % name
78 78 > EOF
79 79
80 80 $ cp foo.py bar.py
81 81 $ echo 'foo = foo.py' >> $HGRCPATH
82 82 $ echo 'bar = bar.py' >> $HGRCPATH
83 83
84 84 Command with no output, we just want to see the extensions loaded:
85 85
86 86 $ hg paths
87 87 1) foo imported
88 88 1) bar imported
89 89 2) foo uisetup
90 90 2) bar uisetup
91 91 3) foo extsetup
92 92 3) bar extsetup
93 93 4) foo reposetup
94 94 4) bar reposetup
95 95
96 96 Check hgweb's load order:
97 97
98 98 $ cat > hgweb.cgi <<EOF
99 99 > #!/usr/bin/env python
100 100 > from mercurial import demandimport; demandimport.enable()
101 101 > from mercurial.hgweb import hgweb
102 102 > from mercurial.hgweb import wsgicgi
103 103 > application = hgweb('.', 'test repo')
104 104 > wsgicgi.launch(application)
105 105 > EOF
106 106
107 107 $ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
108 108 > SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
109 109 > | grep '^[0-9]) ' # ignores HTML output
110 110 1) foo imported
111 111 1) bar imported
112 112 2) foo uisetup
113 113 2) bar uisetup
114 114 3) foo extsetup
115 115 3) bar extsetup
116 116 4) foo reposetup
117 117 4) bar reposetup
118 118 4) foo reposetup
119 119 4) bar reposetup
120 120
121 121 $ echo 'foo = !' >> $HGRCPATH
122 122 $ echo 'bar = !' >> $HGRCPATH
123 123
124 124 Check "from __future__ import absolute_import" support for external libraries
125 125
126 126 #if windows
127 127 $ PATHSEP=";"
128 128 #else
129 129 $ PATHSEP=":"
130 130 #endif
131 131 $ export PATHSEP
132 132
133 133 $ mkdir $TESTTMP/libroot
134 134 $ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
135 135 $ mkdir $TESTTMP/libroot/mod
136 136 $ touch $TESTTMP/libroot/mod/__init__.py
137 137 $ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
138 138
139 139 #if absimport
140 140 $ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
141 141 > from __future__ import absolute_import
142 142 > import ambig # should load "libroot/ambig.py"
143 143 > s = ambig.s
144 144 > EOF
145 145 $ cat > loadabs.py <<EOF
146 146 > import mod.ambigabs as ambigabs
147 147 > def extsetup():
148 148 > print 'ambigabs.s=%s' % ambigabs.s
149 149 > EOF
150 150 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
151 151 ambigabs.s=libroot/ambig.py
152 152 $TESTTMP/a (glob)
153 153 #endif
154 154
155 155 #if no-py3k
156 156 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
157 157 > import ambig # should load "libroot/mod/ambig.py"
158 158 > s = ambig.s
159 159 > EOF
160 160 $ cat > loadrel.py <<EOF
161 161 > import mod.ambigrel as ambigrel
162 162 > def extsetup():
163 163 > print 'ambigrel.s=%s' % ambigrel.s
164 164 > EOF
165 165 $ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
166 166 ambigrel.s=libroot/mod/ambig.py
167 167 $TESTTMP/a (glob)
168 168 #endif
169 169
170 170 Check absolute/relative import of extension specific modules
171 171
172 172 $ mkdir $TESTTMP/extroot
173 173 $ cat > $TESTTMP/extroot/bar.py <<EOF
174 174 > s = 'this is extroot.bar'
175 175 > EOF
176 176 $ mkdir $TESTTMP/extroot/sub1
177 177 $ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
178 178 > s = 'this is extroot.sub1.__init__'
179 179 > EOF
180 180 $ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
181 181 > s = 'this is extroot.sub1.baz'
182 182 > EOF
183 183 $ cat > $TESTTMP/extroot/__init__.py <<EOF
184 184 > s = 'this is extroot.__init__'
185 185 > import foo
186 186 > def extsetup(ui):
187 187 > ui.write('(extroot) ', foo.func(), '\n')
188 188 > EOF
189 189
190 190 $ cat > $TESTTMP/extroot/foo.py <<EOF
191 191 > # test absolute import
192 192 > buf = []
193 193 > def func():
194 194 > # "not locals" case
195 195 > import extroot.bar
196 196 > buf.append('import extroot.bar in func(): %s' % extroot.bar.s)
197 197 > return '\n(extroot) '.join(buf)
198 198 > # "fromlist == ('*',)" case
199 199 > from extroot.bar import *
200 200 > buf.append('from extroot.bar import *: %s' % s)
201 201 > # "not fromlist" and "if '.' in name" case
202 202 > import extroot.sub1.baz
203 203 > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s)
204 204 > # "not fromlist" and NOT "if '.' in name" case
205 205 > import extroot
206 206 > buf.append('import extroot: %s' % extroot.s)
207 207 > # NOT "not fromlist" and NOT "level != -1" case
208 208 > from extroot.bar import s
209 209 > buf.append('from extroot.bar import s: %s' % s)
210 210 > EOF
211 211 $ hg --config extensions.extroot=$TESTTMP/extroot root
212 212 (extroot) from extroot.bar import *: this is extroot.bar
213 213 (extroot) import extroot.sub1.baz: this is extroot.sub1.baz
214 214 (extroot) import extroot: this is extroot.__init__
215 215 (extroot) from extroot.bar import s: this is extroot.bar
216 216 (extroot) import extroot.bar in func(): this is extroot.bar
217 217 $TESTTMP/a (glob)
218 218
219 219 #if no-py3k
220 220 $ rm "$TESTTMP"/extroot/foo.*
221 221 $ cat > $TESTTMP/extroot/foo.py <<EOF
222 222 > # test relative import
223 223 > buf = []
224 224 > def func():
225 225 > # "not locals" case
226 226 > import bar
227 227 > buf.append('import bar in func(): %s' % bar.s)
228 228 > return '\n(extroot) '.join(buf)
229 229 > # "fromlist == ('*',)" case
230 230 > from bar import *
231 231 > buf.append('from bar import *: %s' % s)
232 232 > # "not fromlist" and "if '.' in name" case
233 233 > import sub1.baz
234 234 > buf.append('import sub1.baz: %s' % sub1.baz.s)
235 235 > # "not fromlist" and NOT "if '.' in name" case
236 236 > import sub1
237 237 > buf.append('import sub1: %s' % sub1.s)
238 238 > # NOT "not fromlist" and NOT "level != -1" case
239 239 > from bar import s
240 240 > buf.append('from bar import s: %s' % s)
241 241 > EOF
242 242 $ hg --config extensions.extroot=$TESTTMP/extroot root
243 243 (extroot) from bar import *: this is extroot.bar
244 244 (extroot) import sub1.baz: this is extroot.sub1.baz
245 245 (extroot) import sub1: this is extroot.sub1.__init__
246 246 (extroot) from bar import s: this is extroot.bar
247 247 (extroot) import bar in func(): this is extroot.bar
248 248 $TESTTMP/a (glob)
249 249 #endif
250 250
251 251 $ cd ..
252 252
253 253 hide outer repo
254 254 $ hg init
255 255
256 256 $ cat > empty.py <<EOF
257 257 > '''empty cmdtable
258 258 > '''
259 259 > cmdtable = {}
260 260 > EOF
261 261 $ emptypath=`pwd`/empty.py
262 262 $ echo "empty = $emptypath" >> $HGRCPATH
263 263 $ hg help empty
264 264 empty extension - empty cmdtable
265 265
266 266 no commands defined
267 267
268 268
269 269 $ echo 'empty = !' >> $HGRCPATH
270 270
271 271 $ cat > debugextension.py <<EOF
272 272 > '''only debugcommands
273 273 > '''
274 274 > from mercurial import cmdutil
275 275 > cmdtable = {}
276 276 > command = cmdutil.command(cmdtable)
277 277 > @command('debugfoobar', [], 'hg debugfoobar')
278 278 > def debugfoobar(ui, repo, *args, **opts):
279 279 > "yet another debug command"
280 280 > pass
281 281 > @command('foo', [], 'hg foo')
282 282 > def foo(ui, repo, *args, **opts):
283 283 > """yet another foo command
284 284 > This command has been DEPRECATED since forever.
285 285 > """
286 286 > pass
287 287 > EOF
288 288 $ debugpath=`pwd`/debugextension.py
289 289 $ echo "debugextension = $debugpath" >> $HGRCPATH
290 290
291 291 $ hg help debugextension
292 292 debugextension extension - only debugcommands
293 293
294 294 no commands defined
295 295
296 296
297 297 $ hg --verbose help debugextension
298 298 debugextension extension - only debugcommands
299 299
300 300 list of commands:
301 301
302 302 foo yet another foo command
303 303
304 304 global options ([+] can be repeated):
305 305
306 306 -R --repository REPO repository root directory or name of overlay bundle
307 307 file
308 308 --cwd DIR change working directory
309 309 -y --noninteractive do not prompt, automatically pick the first choice for
310 310 all prompts
311 311 -q --quiet suppress output
312 312 -v --verbose enable additional output
313 313 --config CONFIG [+] set/override config option (use 'section.name=value')
314 314 --debug enable debugging output
315 315 --debugger start debugger
316 316 --encoding ENCODE set the charset encoding (default: ascii)
317 317 --encodingmode MODE set the charset encoding mode (default: strict)
318 318 --traceback always print a traceback on exception
319 319 --time time how long the command takes
320 320 --profile print command execution profile
321 321 --version output version information and exit
322 322 -h --help display help and exit
323 323 --hidden consider hidden changesets
324 324
325 325
326 326
327 327
328 328
329 329
330 330 $ hg --debug help debugextension
331 331 debugextension extension - only debugcommands
332 332
333 333 list of commands:
334 334
335 335 debugfoobar yet another debug command
336 336 foo yet another foo command
337 337
338 338 global options ([+] can be repeated):
339 339
340 340 -R --repository REPO repository root directory or name of overlay bundle
341 341 file
342 342 --cwd DIR change working directory
343 343 -y --noninteractive do not prompt, automatically pick the first choice for
344 344 all prompts
345 345 -q --quiet suppress output
346 346 -v --verbose enable additional output
347 347 --config CONFIG [+] set/override config option (use 'section.name=value')
348 348 --debug enable debugging output
349 349 --debugger start debugger
350 350 --encoding ENCODE set the charset encoding (default: ascii)
351 351 --encodingmode MODE set the charset encoding mode (default: strict)
352 352 --traceback always print a traceback on exception
353 353 --time time how long the command takes
354 354 --profile print command execution profile
355 355 --version output version information and exit
356 356 -h --help display help and exit
357 357 --hidden consider hidden changesets
358 358
359 359
360 360
361 361
362 362
363 363 $ echo 'debugextension = !' >> $HGRCPATH
364 364
365 365 Extension module help vs command help:
366 366
367 367 $ echo 'extdiff =' >> $HGRCPATH
368 368 $ hg help extdiff
369 369 hg extdiff [OPT]... [FILE]...
370 370
371 371 use external program to diff repository (or selected files)
372 372
373 373 Show differences between revisions for the specified files, using an
374 374 external program. The default program used is diff, with default options
375 375 "-Npru".
376 376
377 377 To select a different program, use the -p/--program option. The program
378 378 will be passed the names of two directories to compare. To pass additional
379 379 options to the program, use -o/--option. These will be passed before the
380 380 names of the directories to compare.
381 381
382 382 When two revision arguments are given, then changes are shown between
383 383 those revisions. If only one revision is specified then that revision is
384 384 compared to the working directory, and, when no revisions are specified,
385 385 the working directory files are compared to its parent.
386 386
387 387 (use "hg help -e extdiff" to show help for the extdiff extension)
388 388
389 389 options ([+] can be repeated):
390 390
391 391 -p --program CMD comparison program to run
392 392 -o --option OPT [+] pass option to comparison program
393 393 -r --rev REV [+] revision
394 394 -c --change REV change made by revision
395 395 -I --include PATTERN [+] include names matching the given patterns
396 396 -X --exclude PATTERN [+] exclude names matching the given patterns
397 397
398 398 (some details hidden, use --verbose to show complete help)
399 399
400 400
401 401
402 402
403 403
404 404
405 405
406 406
407 407
408 408
409 409 $ hg help --extension extdiff
410 410 extdiff extension - command to allow external programs to compare revisions
411 411
412 412 The extdiff Mercurial extension allows you to use external programs to compare
413 413 revisions, or revision with working directory. The external diff programs are
414 414 called with a configurable set of options and two non-option arguments: paths
415 415 to directories containing snapshots of files to compare.
416 416
417 417 The extdiff extension also allows you to configure new diff commands, so you
418 418 do not need to type "hg extdiff -p kdiff3" always.
419 419
420 420 [extdiff]
421 421 # add new command that runs GNU diff(1) in 'context diff' mode
422 422 cdiff = gdiff -Nprc5
423 423 ## or the old way:
424 424 #cmd.cdiff = gdiff
425 425 #opts.cdiff = -Nprc5
426 426
427 427 # add new command called meld, runs meld (no need to name twice). If
428 428 # the meld executable is not available, the meld tool in [merge-tools]
429 429 # will be used, if available
430 430 meld =
431 431
432 432 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
433 433 # (see http://www.vim.org/scripts/script.php?script_id=102) Non
434 434 # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
435 435 # your .vimrc
436 436 vimdiff = gvim -f "+next" \
437 437 "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
438 438
439 439 Tool arguments can include variables that are expanded at runtime:
440 440
441 441 $parent1, $plabel1 - filename, descriptive label of first parent
442 442 $child, $clabel - filename, descriptive label of child revision
443 443 $parent2, $plabel2 - filename, descriptive label of second parent
444 444 $root - repository root
445 445 $parent is an alias for $parent1.
446 446
447 447 The extdiff extension will look in your [diff-tools] and [merge-tools]
448 448 sections for diff tool arguments, when none are specified in [extdiff].
449 449
450 450 [extdiff]
451 451 kdiff3 =
452 452
453 453 [diff-tools]
454 454 kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
455 455
456 456 You can use -I/-X and list of file or directory names like normal "hg diff"
457 457 command. The extdiff extension makes snapshots of only needed files, so
458 458 running the external diff program will actually be pretty fast (at least
459 459 faster than having to compare the entire tree).
460 460
461 461 list of commands:
462 462
463 463 extdiff use external program to diff repository (or selected files)
464 464
465 465 (use "hg help -v extdiff" to show built-in aliases and global options)
466 466
467 467
468 468
469 469
470 470
471 471
472 472
473 473
474 474
475 475
476 476
477 477
478 478
479 479
480 480
481 481
482 482 $ echo 'extdiff = !' >> $HGRCPATH
483 483
484 484 Test help topic with same name as extension
485 485
486 486 $ cat > multirevs.py <<EOF
487 487 > from mercurial import cmdutil, commands
488 488 > cmdtable = {}
489 489 > command = cmdutil.command(cmdtable)
490 490 > """multirevs extension
491 491 > Big multi-line module docstring."""
492 492 > @command('multirevs', [], 'ARG', norepo=True)
493 493 > def multirevs(ui, repo, arg, *args, **opts):
494 494 > """multirevs command"""
495 495 > pass
496 496 > EOF
497 497 $ echo "multirevs = multirevs.py" >> $HGRCPATH
498 498
499 499 $ hg help multirevs
500 500 Specifying Multiple Revisions
501 501 """""""""""""""""""""""""""""
502 502
503 503 When Mercurial accepts more than one revision, they may be specified
504 504 individually, or provided as a topologically continuous range, separated
505 505 by the ":" character.
506 506
507 507 The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
508 508 revision identifiers. Both BEGIN and END are optional. If BEGIN is not
509 509 specified, it defaults to revision number 0. If END is not specified, it
510 510 defaults to the tip. The range ":" thus means "all revisions".
511 511
512 512 If BEGIN is greater than END, revisions are treated in reverse order.
513 513
514 514 A range acts as a closed interval. This means that a range of 3:5 gives 3,
515 515 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
516 516
517 517 use "hg help -c multirevs" to see help for the multirevs command
518 518
519 519
520 520
521 521
522 522
523 523
524 524 $ hg help -c multirevs
525 525 hg multirevs ARG
526 526
527 527 multirevs command
528 528
529 529 (some details hidden, use --verbose to show complete help)
530 530
531 531
532 532
533 533 $ hg multirevs
534 534 hg multirevs: invalid arguments
535 535 hg multirevs ARG
536 536
537 537 multirevs command
538 538
539 539 (use "hg multirevs -h" to show more help)
540 540 [255]
541 541
542 542
543 543
544 544 $ echo "multirevs = !" >> $HGRCPATH
545 545
546 546 Issue811: Problem loading extensions twice (by site and by user)
547 547
548 548 $ debugpath=`pwd`/debugissue811.py
549 549 $ cat > debugissue811.py <<EOF
550 550 > '''show all loaded extensions
551 551 > '''
552 552 > from mercurial import cmdutil, commands, extensions
553 553 > cmdtable = {}
554 554 > command = cmdutil.command(cmdtable)
555 555 > @command('debugextensions', [], 'hg debugextensions', norepo=True)
556 556 > def debugextensions(ui):
557 557 > "yet another debug command"
558 558 > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
559 559 > EOF
560 $ echo "debugissue811 = $debugpath" >> $HGRCPATH
561 $ echo "mq=" >> $HGRCPATH
562 $ echo "strip=" >> $HGRCPATH
563 $ echo "hgext.mq=" >> $HGRCPATH
564 $ echo "hgext/mq=" >> $HGRCPATH
560 $ cat <<EOF >> $HGRCPATH
561 > debugissue811 = $debugpath
562 > mq =
563 > strip =
564 > hgext.mq =
565 > hgext/mq =
566 > EOF
565 567
566 568 Show extensions:
567 569 (note that mq force load strip, also checking it's not loaded twice)
568 570
569 571 $ hg debugextensions
570 572 debugissue811
571 573 strip
572 574 mq
573 575
574 576 Disabled extension commands:
575 577
576 578 $ ORGHGRCPATH=$HGRCPATH
577 579 $ HGRCPATH=
578 580 $ export HGRCPATH
579 581 $ hg help email
580 582 'email' is provided by the following extension:
581 583
582 584 patchbomb command to send changesets as (a series of) patch emails
583 585
584 586 (use "hg help extensions" for information on enabling extensions)
585 587
586 588
587 589 $ hg qdel
588 590 hg: unknown command 'qdel'
589 591 'qdelete' is provided by the following extension:
590 592
591 593 mq manage a stack of patches
592 594
593 595 (use "hg help extensions" for information on enabling extensions)
594 596 [255]
595 597
596 598
597 599 $ hg churn
598 600 hg: unknown command 'churn'
599 601 'churn' is provided by the following extension:
600 602
601 603 churn command to display statistics about repository history
602 604
603 605 (use "hg help extensions" for information on enabling extensions)
604 606 [255]
605 607
606 608
607 609
608 610 Disabled extensions:
609 611
610 612 $ hg help churn
611 613 churn extension - command to display statistics about repository history
612 614
613 615 (use "hg help extensions" for information on enabling extensions)
614 616
615 617 $ hg help patchbomb
616 618 patchbomb extension - command to send changesets as (a series of) patch emails
617 619
618 620 (use "hg help extensions" for information on enabling extensions)
619 621
620 622
621 623 Broken disabled extension and command:
622 624
623 625 $ mkdir hgext
624 626 $ echo > hgext/__init__.py
625 627 $ cat > hgext/broken.py <<EOF
626 628 > "broken extension'
627 629 > EOF
628 630 $ cat > path.py <<EOF
629 631 > import os, sys
630 632 > sys.path.insert(0, os.environ['HGEXTPATH'])
631 633 > EOF
632 634 $ HGEXTPATH=`pwd`
633 635 $ export HGEXTPATH
634 636
635 637 $ hg --config extensions.path=./path.py help broken
636 638 broken extension - (no help text available)
637 639
638 640 (use "hg help extensions" for information on enabling extensions)
639 641
640 642
641 643 $ cat > hgext/forest.py <<EOF
642 644 > cmdtable = None
643 645 > EOF
644 646 $ hg --config extensions.path=./path.py help foo > /dev/null
645 647 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
646 648 abort: no such help topic: foo
647 649 (try "hg help --keyword foo")
648 650 [255]
649 651
650 652 $ cat > throw.py <<EOF
651 653 > from mercurial import cmdutil, commands
652 654 > cmdtable = {}
653 655 > command = cmdutil.command(cmdtable)
654 656 > class Bogon(Exception): pass
655 657 > @command('throw', [], 'hg throw', norepo=True)
656 658 > def throw(ui, **opts):
657 659 > """throws an exception"""
658 660 > raise Bogon()
659 661 > EOF
660 662 No declared supported version, extension complains:
661 663 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
662 664 ** Unknown exception encountered with possibly-broken third-party extension throw
663 665 ** which supports versions unknown of Mercurial.
664 666 ** Please disable throw and try your action again.
665 667 ** If that fixes the bug please report it to the extension author.
666 668 ** Python * (glob)
667 669 ** Mercurial Distributed SCM * (glob)
668 670 ** Extensions loaded: throw
669 671 empty declaration of supported version, extension complains:
670 672 $ echo "testedwith = ''" >> throw.py
671 673 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
672 674 ** Unknown exception encountered with possibly-broken third-party extension throw
673 675 ** which supports versions unknown of Mercurial.
674 676 ** Please disable throw and try your action again.
675 677 ** If that fixes the bug please report it to the extension author.
676 678 ** Python * (glob)
677 679 ** Mercurial Distributed SCM (*) (glob)
678 680 ** Extensions loaded: throw
679 681 If the extension specifies a buglink, show that:
680 682 $ echo 'buglink = "http://example.com/bts"' >> throw.py
681 683 $ rm -f throw.pyc throw.pyo
682 684 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
683 685 ** Unknown exception encountered with possibly-broken third-party extension throw
684 686 ** which supports versions unknown of Mercurial.
685 687 ** Please disable throw and try your action again.
686 688 ** If that fixes the bug please report it to http://example.com/bts
687 689 ** Python * (glob)
688 690 ** Mercurial Distributed SCM (*) (glob)
689 691 ** Extensions loaded: throw
690 692 If the extensions declare outdated versions, accuse the older extension first:
691 693 $ echo "from mercurial import util" >> older.py
692 694 $ echo "util.version = lambda:'2.2'" >> older.py
693 695 $ echo "testedwith = '1.9.3'" >> older.py
694 696 $ echo "testedwith = '2.1.1'" >> throw.py
695 697 $ rm -f throw.pyc throw.pyo
696 698 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
697 699 > throw 2>&1 | egrep '^\*\*'
698 700 ** Unknown exception encountered with possibly-broken third-party extension older
699 701 ** which supports versions 1.9.3 of Mercurial.
700 702 ** Please disable older and try your action again.
701 703 ** If that fixes the bug please report it to the extension author.
702 704 ** Python * (glob)
703 705 ** Mercurial Distributed SCM (version 2.2)
704 706 ** Extensions loaded: throw, older
705 707 One extension only tested with older, one only with newer versions:
706 708 $ echo "util.version = lambda:'2.1.0'" >> older.py
707 709 $ rm -f older.pyc older.pyo
708 710 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
709 711 > throw 2>&1 | egrep '^\*\*'
710 712 ** Unknown exception encountered with possibly-broken third-party extension older
711 713 ** which supports versions 1.9.3 of Mercurial.
712 714 ** Please disable older and try your action again.
713 715 ** If that fixes the bug please report it to the extension author.
714 716 ** Python * (glob)
715 717 ** Mercurial Distributed SCM (version 2.1.0)
716 718 ** Extensions loaded: throw, older
717 719 Older extension is tested with current version, the other only with newer:
718 720 $ echo "util.version = lambda:'1.9.3'" >> older.py
719 721 $ rm -f older.pyc older.pyo
720 722 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
721 723 > throw 2>&1 | egrep '^\*\*'
722 724 ** Unknown exception encountered with possibly-broken third-party extension throw
723 725 ** which supports versions 2.1.1 of Mercurial.
724 726 ** Please disable throw and try your action again.
725 727 ** If that fixes the bug please report it to http://example.com/bts
726 728 ** Python * (glob)
727 729 ** Mercurial Distributed SCM (version 1.9.3)
728 730 ** Extensions loaded: throw, older
729 731
730 732 Declare the version as supporting this hg version, show regular bts link:
731 733 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'`
732 734 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
733 735 $ rm -f throw.pyc throw.pyo
734 736 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
735 737 ** unknown exception encountered, please report by visiting
736 738 ** http://mercurial.selenic.com/wiki/BugTracker
737 739 ** Python * (glob)
738 740 ** Mercurial Distributed SCM (*) (glob)
739 741 ** Extensions loaded: throw
740 742
741 743 Test version number support in 'hg version':
742 744 $ echo '__version__ = (1, 2, 3)' >> throw.py
743 745 $ rm -f throw.pyc throw.pyo
744 746 $ hg version -v
745 747 Mercurial Distributed SCM (version *) (glob)
746 748 (see http://mercurial.selenic.com for more information)
747 749
748 750 Copyright (C) 2005-* Matt Mackall and others (glob)
749 751 This is free software; see the source for copying conditions. There is NO
750 752 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
751 753
752 754 Enabled extensions:
753 755
754 756
755 757 $ hg version -v --config extensions.throw=throw.py
756 758 Mercurial Distributed SCM (version *) (glob)
757 759 (see http://mercurial.selenic.com for more information)
758 760
759 761 Copyright (C) 2005-* Matt Mackall and others (glob)
760 762 This is free software; see the source for copying conditions. There is NO
761 763 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
762 764
763 765 Enabled extensions:
764 766
765 767 throw 1.2.3
766 768 $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
767 769 $ rm -f throw.pyc throw.pyo
768 770 $ hg version -v --config extensions.throw=throw.py
769 771 Mercurial Distributed SCM (version *) (glob)
770 772 (see http://mercurial.selenic.com for more information)
771 773
772 774 Copyright (C) 2005-* Matt Mackall and others (glob)
773 775 This is free software; see the source for copying conditions. There is NO
774 776 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
775 777
776 778 Enabled extensions:
777 779
778 780 throw 1.twentythree
779 781
780 782 Restore HGRCPATH
781 783
782 784 $ HGRCPATH=$ORGHGRCPATH
783 785 $ export HGRCPATH
784 786
785 787 Commands handling multiple repositories at a time should invoke only
786 788 "reposetup()" of extensions enabling in the target repository.
787 789
788 790 $ mkdir reposetup-test
789 791 $ cd reposetup-test
790 792
791 793 $ cat > $TESTTMP/reposetuptest.py <<EOF
792 794 > from mercurial import extensions
793 795 > def reposetup(ui, repo):
794 796 > ui.write('reposetup() for %s\n' % (repo.root))
795 797 > EOF
796 798 $ hg init src
797 799 $ echo a > src/a
798 800 $ hg -R src commit -Am '#0 at src/a'
799 801 adding a
800 802 $ echo '[extensions]' >> src/.hg/hgrc
801 803 $ echo '# enable extension locally' >> src/.hg/hgrc
802 804 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
803 805 $ hg -R src status
804 806 reposetup() for $TESTTMP/reposetup-test/src (glob)
805 807
806 808 $ hg clone -U src clone-dst1
807 809 reposetup() for $TESTTMP/reposetup-test/src (glob)
808 810 $ hg init push-dst1
809 811 $ hg -q -R src push push-dst1
810 812 reposetup() for $TESTTMP/reposetup-test/src (glob)
811 813 $ hg init pull-src1
812 814 $ hg -q -R pull-src1 pull src
813 815 reposetup() for $TESTTMP/reposetup-test/src (glob)
814 816
815 $ echo '[extensions]' >> $HGRCPATH
816 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
817 $ echo 'reposetuptest = !' >> $HGRCPATH
817 $ cat <<EOF >> $HGRCPATH
818 > [extensions]
819 > # disable extension globally and explicitly
820 > reposetuptest = !
821 > EOF
818 822 $ hg clone -U src clone-dst2
819 823 reposetup() for $TESTTMP/reposetup-test/src (glob)
820 824 $ hg init push-dst2
821 825 $ hg -q -R src push push-dst2
822 826 reposetup() for $TESTTMP/reposetup-test/src (glob)
823 827 $ hg init pull-src2
824 828 $ hg -q -R pull-src2 pull src
825 829 reposetup() for $TESTTMP/reposetup-test/src (glob)
826 830
827 $ echo '[extensions]' >> $HGRCPATH
828 $ echo '# enable extension globally' >> $HGRCPATH
829 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
831 $ cat <<EOF >> $HGRCPATH
832 > [extensions]
833 > # enable extension globally
834 > reposetuptest = $TESTTMP/reposetuptest.py
835 > EOF
830 836 $ hg clone -U src clone-dst3
831 837 reposetup() for $TESTTMP/reposetup-test/src (glob)
832 838 reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
833 839 $ hg init push-dst3
834 840 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
835 841 $ hg -q -R src push push-dst3
836 842 reposetup() for $TESTTMP/reposetup-test/src (glob)
837 843 reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
838 844 $ hg init pull-src3
839 845 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
840 846 $ hg -q -R pull-src3 pull src
841 847 reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
842 848 reposetup() for $TESTTMP/reposetup-test/src (glob)
843 849
844 850 $ echo '[extensions]' >> src/.hg/hgrc
845 851 $ echo '# disable extension locally' >> src/.hg/hgrc
846 852 $ echo 'reposetuptest = !' >> src/.hg/hgrc
847 853 $ hg clone -U src clone-dst4
848 854 reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
849 855 $ hg init push-dst4
850 856 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
851 857 $ hg -q -R src push push-dst4
852 858 reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
853 859 $ hg init pull-src4
854 860 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
855 861 $ hg -q -R pull-src4 pull src
856 862 reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
857 863
858 864 disabling in command line overlays with all configuration
859 865 $ hg --config extensions.reposetuptest=! clone -U src clone-dst5
860 866 $ hg --config extensions.reposetuptest=! init push-dst5
861 867 $ hg --config extensions.reposetuptest=! -q -R src push push-dst5
862 868 $ hg --config extensions.reposetuptest=! init pull-src5
863 869 $ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
864 870
865 $ echo '[extensions]' >> $HGRCPATH
866 $ echo '# disable extension globally and explicitly' >> $HGRCPATH
867 $ echo 'reposetuptest = !' >> $HGRCPATH
871 $ cat <<EOF >> $HGRCPATH
872 > [extensions]
873 > # disable extension globally and explicitly
874 > reposetuptest = !
875 > EOF
868 876 $ hg init parent
869 877 $ hg init parent/sub1
870 878 $ echo 1 > parent/sub1/1
871 879 $ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
872 880 adding 1
873 881 $ hg init parent/sub2
874 882 $ hg init parent/sub2/sub21
875 883 $ echo 21 > parent/sub2/sub21/21
876 884 $ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
877 885 adding 21
878 886 $ cat > parent/sub2/.hgsub <<EOF
879 887 > sub21 = sub21
880 888 > EOF
881 889 $ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
882 890 adding .hgsub
883 891 $ hg init parent/sub3
884 892 $ echo 3 > parent/sub3/3
885 893 $ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
886 894 adding 3
887 895 $ cat > parent/.hgsub <<EOF
888 896 > sub1 = sub1
889 897 > sub2 = sub2
890 898 > sub3 = sub3
891 899 > EOF
892 900 $ hg -R parent commit -Am '#0 at parent'
893 901 adding .hgsub
894 902 $ echo '[extensions]' >> parent/.hg/hgrc
895 903 $ echo '# enable extension locally' >> parent/.hg/hgrc
896 904 $ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
897 905 $ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
898 906 $ hg -R parent status -S -A
899 907 reposetup() for $TESTTMP/reposetup-test/parent (glob)
900 908 reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
901 909 C .hgsub
902 910 C .hgsubstate
903 911 C sub1/1
904 912 C sub2/.hgsub
905 913 C sub2/.hgsubstate
906 914 C sub2/sub21/21
907 915 C sub3/3
908 916
909 917 $ cd ..
@@ -1,209 +1,211 b''
1 1
2 2 Test interactions between mq and patch.eol
3 3
4 4
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "mq=" >> $HGRCPATH
7 $ echo "[diff]" >> $HGRCPATH
8 $ echo "nodates=1" >> $HGRCPATH
5 $ cat <<EOF >> $HGRCPATH
6 > [extensions]
7 > mq =
8 > [diff]
9 > nodates = 1
10 > EOF
9 11
10 12 $ cat > makepatch.py <<EOF
11 13 > f = file('eol.diff', 'wb')
12 14 > w = f.write
13 15 > w('test message\n')
14 16 > w('diff --git a/a b/a\n')
15 17 > w('--- a/a\n')
16 18 > w('+++ b/a\n')
17 19 > w('@@ -1,5 +1,5 @@\n')
18 20 > w(' a\n')
19 21 > w('-b\r\n')
20 22 > w('+y\r\n')
21 23 > w(' c\r\n')
22 24 > w(' d\n')
23 25 > w('-e\n')
24 26 > w('\ No newline at end of file\n')
25 27 > w('+z\r\n')
26 28 > w('\ No newline at end of file\r\n')
27 29 > EOF
28 30
29 31 $ cat > cateol.py <<EOF
30 32 > import sys
31 33 > for line in file(sys.argv[1], 'rb'):
32 34 > line = line.replace('\r', '<CR>')
33 35 > line = line.replace('\n', '<LF>')
34 36 > print line
35 37 > EOF
36 38
37 39 $ hg init repo
38 40 $ cd repo
39 41 $ echo '\.diff' > .hgignore
40 42 $ echo '\.rej' >> .hgignore
41 43
42 44
43 45 Test different --eol values
44 46
45 47 $ $PYTHON -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
46 48 $ hg ci -Am adda
47 49 adding .hgignore
48 50 adding a
49 51 $ python ../makepatch.py
50 52 $ hg qimport eol.diff
51 53 adding eol.diff to series file
52 54
53 55 should fail in strict mode
54 56
55 57 $ hg qpush
56 58 applying eol.diff
57 59 patching file a
58 60 Hunk #1 FAILED at 0
59 61 1 out of 1 hunks FAILED -- saving rejects to file a.rej
60 62 patch failed, unable to continue (try -v)
61 63 patch failed, rejects left in working dir
62 64 errors during apply, please fix and refresh eol.diff
63 65 [2]
64 66 $ hg qpop
65 67 popping eol.diff
66 68 patch queue now empty
67 69
68 70 invalid eol
69 71
70 72 $ hg --config patch.eol='LFCR' qpush
71 73 applying eol.diff
72 74 patch failed, unable to continue (try -v)
73 75 patch failed, rejects left in working dir
74 76 errors during apply, please fix and refresh eol.diff
75 77 [2]
76 78 $ hg qpop
77 79 popping eol.diff
78 80 patch queue now empty
79 81
80 82 force LF
81 83
82 84 $ hg --config patch.eol='CRLF' qpush
83 85 applying eol.diff
84 86 now at: eol.diff
85 87 $ hg qrefresh
86 88 $ python ../cateol.py .hg/patches/eol.diff
87 89 # HG changeset patch<LF>
88 90 # Parent 0d0bf99a8b7a3842c6f8ef09e34f69156c4bd9d0<LF>
89 91 test message<LF>
90 92 <LF>
91 93 diff -r 0d0bf99a8b7a a<LF>
92 94 --- a/a<LF>
93 95 +++ b/a<LF>
94 96 @@ -1,5 +1,5 @@<LF>
95 97 -a<LF>
96 98 -b<LF>
97 99 -c<LF>
98 100 -d<LF>
99 101 -e<LF>
100 102 \ No newline at end of file<LF>
101 103 +a<CR><LF>
102 104 +y<CR><LF>
103 105 +c<CR><LF>
104 106 +d<CR><LF>
105 107 +z<LF>
106 108 \ No newline at end of file<LF>
107 109 $ python ../cateol.py a
108 110 a<CR><LF>
109 111 y<CR><LF>
110 112 c<CR><LF>
111 113 d<CR><LF>
112 114 z
113 115 $ hg qpop
114 116 popping eol.diff
115 117 patch queue now empty
116 118
117 119 push again forcing LF and compare revisions
118 120
119 121 $ hg --config patch.eol='CRLF' qpush
120 122 applying eol.diff
121 123 now at: eol.diff
122 124 $ python ../cateol.py a
123 125 a<CR><LF>
124 126 y<CR><LF>
125 127 c<CR><LF>
126 128 d<CR><LF>
127 129 z
128 130 $ hg qpop
129 131 popping eol.diff
130 132 patch queue now empty
131 133
132 134 push again without LF and compare revisions
133 135
134 136 $ hg qpush
135 137 applying eol.diff
136 138 now at: eol.diff
137 139 $ python ../cateol.py a
138 140 a<CR><LF>
139 141 y<CR><LF>
140 142 c<CR><LF>
141 143 d<CR><LF>
142 144 z
143 145 $ hg qpop
144 146 popping eol.diff
145 147 patch queue now empty
146 148 $ cd ..
147 149
148 150
149 151 Test .rej file EOL are left unchanged
150 152
151 153 $ hg init testeol
152 154 $ cd testeol
153 155 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
154 156 $ hg ci -Am adda
155 157 adding a
156 158 $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
157 159 $ hg qnew patch1
158 160 $ hg qpop
159 161 popping patch1
160 162 patch queue now empty
161 163 $ $PYTHON -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
162 164 $ hg ci -m changea
163 165
164 166 $ hg --config 'patch.eol=LF' qpush
165 167 applying patch1
166 168 patching file a
167 169 Hunk #1 FAILED at 0
168 170 1 out of 1 hunks FAILED -- saving rejects to file a.rej
169 171 patch failed, unable to continue (try -v)
170 172 patch failed, rejects left in working dir
171 173 errors during apply, please fix and refresh patch1
172 174 [2]
173 175 $ hg qpop
174 176 popping patch1
175 177 patch queue now empty
176 178 $ cat a.rej
177 179 --- a
178 180 +++ a
179 181 @@ -1,4 +1,4 @@
180 182 1\r (esc)
181 183 2\r (esc)
182 184 -3\r (esc)
183 185 +33\r (esc)
184 186 4
185 187 \ No newline at end of file
186 188
187 189 $ hg --config 'patch.eol=auto' qpush
188 190 applying patch1
189 191 patching file a
190 192 Hunk #1 FAILED at 0
191 193 1 out of 1 hunks FAILED -- saving rejects to file a.rej
192 194 patch failed, unable to continue (try -v)
193 195 patch failed, rejects left in working dir
194 196 errors during apply, please fix and refresh patch1
195 197 [2]
196 198 $ hg qpop
197 199 popping patch1
198 200 patch queue now empty
199 201 $ cat a.rej
200 202 --- a
201 203 +++ a
202 204 @@ -1,4 +1,4 @@
203 205 1\r (esc)
204 206 2\r (esc)
205 207 -3\r (esc)
206 208 +33\r (esc)
207 209 4
208 210 \ No newline at end of file
209 211 $ cd ..
@@ -1,210 +1,212 b''
1 1 # Test the plumbing of mq.git option
2 2 # Automatic upgrade itself is tested elsewhere.
3 3
4 $ echo "[extensions]" >> $HGRCPATH
5 $ echo "mq=" >> $HGRCPATH
6 $ echo "[diff]" >> $HGRCPATH
7 $ echo "nodates=1" >> $HGRCPATH
4 $ cat <<EOF >> $HGRCPATH
5 > [extensions]
6 > mq =
7 > [diff]
8 > nodates = 1
9 > EOF
8 10
9 11 $ hg init repo-auto
10 12 $ cd repo-auto
11 13
12 14 git=auto: regular patch creation:
13 15
14 16 $ echo a > a
15 17 $ hg add a
16 18 $ hg qnew -d '0 0' -f adda
17 19
18 20 $ cat .hg/patches/adda
19 21 # HG changeset patch
20 22 # Date 0 0
21 23 # Parent 0000000000000000000000000000000000000000
22 24
23 25 diff -r 000000000000 -r ef8dafc9fa4c a
24 26 --- /dev/null
25 27 +++ b/a
26 28 @@ -0,0 +1,1 @@
27 29 +a
28 30
29 31 git=auto: git patch creation with copy:
30 32
31 33 $ hg cp a b
32 34 $ hg qnew -d '0 0' -f copy
33 35
34 36 $ cat .hg/patches/copy
35 37 # HG changeset patch
36 38 # Date 0 0
37 39 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
38 40
39 41 diff --git a/a b/b
40 42 copy from a
41 43 copy to b
42 44
43 45 git=auto: git patch when using --git:
44 46
45 47 $ echo regular > regular
46 48 $ hg add regular
47 49 $ hg qnew -d '0 0' --git -f git
48 50
49 51 $ cat .hg/patches/git
50 52 # HG changeset patch
51 53 # Date 0 0
52 54 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
53 55
54 56 diff --git a/regular b/regular
55 57 new file mode 100644
56 58 --- /dev/null
57 59 +++ b/regular
58 60 @@ -0,0 +1,1 @@
59 61 +regular
60 62
61 63 git=auto: regular patch after qrefresh without --git:
62 64
63 65 $ hg qrefresh -d '0 0'
64 66
65 67 $ cat .hg/patches/git
66 68 # HG changeset patch
67 69 # Date 0 0
68 70 # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
69 71
70 72 diff -r 99586d5f048c regular
71 73 --- /dev/null
72 74 +++ b/regular
73 75 @@ -0,0 +1,1 @@
74 76 +regular
75 77
76 78 $ cd ..
77 79
78 80 $ hg init repo-keep
79 81 $ cd repo-keep
80 82 $ echo '[mq]' > .hg/hgrc
81 83 $ echo 'git = KEEP' >> .hg/hgrc
82 84
83 85 git=keep: git patch with --git:
84 86
85 87 $ echo a > a
86 88 $ hg add a
87 89 $ hg qnew -d '0 0' -f --git git
88 90
89 91 $ cat .hg/patches/git
90 92 # HG changeset patch
91 93 # Date 0 0
92 94 # Parent 0000000000000000000000000000000000000000
93 95
94 96 diff --git a/a b/a
95 97 new file mode 100644
96 98 --- /dev/null
97 99 +++ b/a
98 100 @@ -0,0 +1,1 @@
99 101 +a
100 102
101 103 git=keep: git patch after qrefresh without --git:
102 104
103 105 $ echo a >> a
104 106 $ hg qrefresh -d '0 0'
105 107
106 108 $ cat .hg/patches/git
107 109 # HG changeset patch
108 110 # Date 0 0
109 111 # Parent 0000000000000000000000000000000000000000
110 112
111 113 diff --git a/a b/a
112 114 new file mode 100644
113 115 --- /dev/null
114 116 +++ b/a
115 117 @@ -0,0 +1,2 @@
116 118 +a
117 119 +a
118 120 $ cd ..
119 121
120 122 $ hg init repo-yes
121 123 $ cd repo-yes
122 124 $ echo '[mq]' > .hg/hgrc
123 125 $ echo 'git = yes' >> .hg/hgrc
124 126
125 127 git=yes: git patch:
126 128
127 129 $ echo a > a
128 130 $ hg add a
129 131 $ hg qnew -d '0 0' -f git
130 132
131 133 $ cat .hg/patches/git
132 134 # HG changeset patch
133 135 # Date 0 0
134 136 # Parent 0000000000000000000000000000000000000000
135 137
136 138 diff --git a/a b/a
137 139 new file mode 100644
138 140 --- /dev/null
139 141 +++ b/a
140 142 @@ -0,0 +1,1 @@
141 143 +a
142 144
143 145 git=yes: git patch after qrefresh:
144 146
145 147 $ echo a >> a
146 148 $ hg qrefresh -d '0 0'
147 149
148 150 $ cat .hg/patches/git
149 151 # HG changeset patch
150 152 # Date 0 0
151 153 # Parent 0000000000000000000000000000000000000000
152 154
153 155 diff --git a/a b/a
154 156 new file mode 100644
155 157 --- /dev/null
156 158 +++ b/a
157 159 @@ -0,0 +1,2 @@
158 160 +a
159 161 +a
160 162 $ cd ..
161 163
162 164 $ hg init repo-no
163 165 $ cd repo-no
164 166 $ echo '[diff]' > .hg/hgrc
165 167 $ echo 'git = True' >> .hg/hgrc
166 168 $ echo '[mq]' > .hg/hgrc
167 169 $ echo 'git = False' >> .hg/hgrc
168 170
169 171 git=no: regular patch with copy:
170 172
171 173 $ echo a > a
172 174 $ hg add a
173 175 $ hg qnew -d '0 0' -f adda
174 176 $ hg cp a b
175 177 $ hg qnew -d '0 0' -f regular
176 178
177 179 $ cat .hg/patches/regular
178 180 # HG changeset patch
179 181 # Date 0 0
180 182 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
181 183
182 184 diff -r ef8dafc9fa4c -r a70404f79ba3 b
183 185 --- /dev/null
184 186 +++ b/b
185 187 @@ -0,0 +1,1 @@
186 188 +a
187 189
188 190 git=no: regular patch after qrefresh with copy:
189 191
190 192 $ hg cp a c
191 193 $ hg qrefresh -d '0 0'
192 194
193 195 $ cat .hg/patches/regular
194 196 # HG changeset patch
195 197 # Date 0 0
196 198 # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
197 199
198 200 diff -r ef8dafc9fa4c b
199 201 --- /dev/null
200 202 +++ b/b
201 203 @@ -0,0 +1,1 @@
202 204 +a
203 205 diff -r ef8dafc9fa4c c
204 206 --- /dev/null
205 207 +++ b/c
206 208 @@ -0,0 +1,1 @@
207 209 +a
208 210
209 211 $ cd ..
210 212
@@ -1,892 +1,894 b''
1 1
2 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "mq=" >> $HGRCPATH
4 $ echo "[diff]" >> $HGRCPATH
5 $ echo "nodates=true" >> $HGRCPATH
2 $ cat <<EOF >> $HGRCPATH
3 > [extensions]
4 > mq =
5 > [diff]
6 > nodates = true
7 > EOF
6 8 $ catpatch() {
7 9 > cat .hg/patches/$1.patch | sed -e "s/^diff \-r [0-9a-f]* /diff -r ... /" \
8 10 > -e "s/^\(# Parent \).*/\1/"
9 11 > }
10 12 $ catlog() {
11 13 > catpatch $1
12 14 > hg log --template "{rev}: {desc} - {author}\n"
13 15 > }
14 16 $ catlogd() {
15 17 > catpatch $1
16 18 > hg log --template "{rev}: {desc} - {author} - {date}\n"
17 19 > }
18 20 $ drop() {
19 21 > hg qpop
20 22 > hg qdel $1.patch
21 23 > }
22 24 $ runtest() {
23 25 > echo ==== init
24 26 > hg init a
25 27 > cd a
26 28 > hg qinit
27 29 >
28 30 >
29 31 > echo ==== qnew -d
30 32 > hg qnew -d '3 0' 1.patch
31 33 > catlogd 1
32 34 >
33 35 > echo ==== qref
34 36 > echo "1" >1
35 37 > hg add
36 38 > hg qref
37 39 > catlogd 1
38 40 >
39 41 > echo ==== qref -d
40 42 > hg qref -d '4 0'
41 43 > catlogd 1
42 44 >
43 45 >
44 46 > echo ==== qnew
45 47 > hg qnew 2.patch
46 48 > echo "2" >2
47 49 > hg add
48 50 > hg qref
49 51 > catlog 2
50 52 >
51 53 > echo ==== qref -d
52 54 > hg qref -d '5 0'
53 55 > catlog 2
54 56 >
55 57 > drop 2
56 58 >
57 59 >
58 60 > echo ==== qnew -d -m
59 61 > hg qnew -d '6 0' -m "Three" 3.patch
60 62 > catlogd 3
61 63 >
62 64 > echo ==== qref
63 65 > echo "3" >3
64 66 > hg add
65 67 > hg qref
66 68 > catlogd 3
67 69 >
68 70 > echo ==== qref -m
69 71 > hg qref -m "Drei"
70 72 > catlogd 3
71 73 >
72 74 > echo ==== qref -d
73 75 > hg qref -d '7 0'
74 76 > catlogd 3
75 77 >
76 78 > echo ==== qref -d -m
77 79 > hg qref -d '8 0' -m "Three (again)"
78 80 > catlogd 3
79 81 >
80 82 >
81 83 > echo ==== qnew -m
82 84 > hg qnew -m "Four" 4.patch
83 85 > echo "4" >4
84 86 > hg add
85 87 > hg qref
86 88 > catlog 4
87 89 >
88 90 > echo ==== qref -d
89 91 > hg qref -d '9 0'
90 92 > catlog 4
91 93 >
92 94 > drop 4
93 95 >
94 96 >
95 97 > echo ==== qnew with HG header
96 98 > hg qnew --config 'mq.plain=true' 5.patch
97 99 > hg qpop
98 100 > echo "# HG changeset patch" >>.hg/patches/5.patch
99 101 > echo "# Date 10 0" >>.hg/patches/5.patch
100 102 > hg qpush 2>&1 | grep 'Now at'
101 103 > catlogd 5
102 104 >
103 105 > echo ==== hg qref
104 106 > echo "5" >5
105 107 > hg add
106 108 > hg qref
107 109 > catlogd 5
108 110 >
109 111 > echo ==== hg qref -d
110 112 > hg qref -d '11 0'
111 113 > catlogd 5
112 114 >
113 115 >
114 116 > echo ==== qnew with plain header
115 117 > hg qnew --config 'mq.plain=true' -d '12 0' 6.patch
116 118 > hg qpop
117 119 > hg qpush 2>&1 | grep 'now at'
118 120 > catlog 6
119 121 >
120 122 > echo ==== hg qref
121 123 > echo "6" >6
122 124 > hg add
123 125 > hg qref
124 126 > catlogd 6
125 127 >
126 128 > echo ==== hg qref -d
127 129 > hg qref -d '13 0'
128 130 > catlogd 6
129 131 >
130 132 > drop 6
131 133 >
132 134 >
133 135 > echo ==== qnew -u
134 136 > hg qnew -u jane 6.patch
135 137 > echo "6" >6
136 138 > hg add
137 139 > hg qref
138 140 > catlog 6
139 141 >
140 142 > echo ==== qref -d
141 143 > hg qref -d '12 0'
142 144 > catlog 6
143 145 >
144 146 > drop 6
145 147 >
146 148 >
147 149 > echo ==== qnew -d
148 150 > hg qnew -d '13 0' 7.patch
149 151 > echo "7" >7
150 152 > hg add
151 153 > hg qref
152 154 > catlog 7
153 155 >
154 156 > echo ==== qref -u
155 157 > hg qref -u john
156 158 > catlogd 7
157 159 >
158 160 >
159 161 > echo ==== qnew
160 162 > hg qnew 8.patch
161 163 > echo "8" >8
162 164 > hg add
163 165 > hg qref
164 166 > catlog 8
165 167 >
166 168 > echo ==== qref -u -d
167 169 > hg qref -u john -d '14 0'
168 170 > catlog 8
169 171 >
170 172 > drop 8
171 173 >
172 174 >
173 175 > echo ==== qnew -m
174 176 > hg qnew -m "Nine" 9.patch
175 177 > echo "9" >9
176 178 > hg add
177 179 > hg qref
178 180 > catlog 9
179 181 >
180 182 > echo ==== qref -u -d
181 183 > hg qref -u john -d '15 0'
182 184 > catlog 9
183 185 >
184 186 > drop 9
185 187 >
186 188 >
187 189 > echo ==== "qpop -a / qpush -a"
188 190 > hg qpop -a
189 191 > hg qpush -a
190 192 > hg log --template "{rev}: {desc} - {author} - {date}\n"
191 193 > }
192 194
193 195 ======= plain headers
194 196
195 197 $ echo "[mq]" >> $HGRCPATH
196 198 $ echo "plain=true" >> $HGRCPATH
197 199 $ mkdir sandbox
198 200 $ (cd sandbox ; runtest)
199 201 ==== init
200 202 ==== qnew -d
201 203 Date: 3 0
202 204
203 205 0: [mq]: 1.patch - test - 3.00
204 206 ==== qref
205 207 adding 1
206 208 Date: 3 0
207 209
208 210 diff -r ... 1
209 211 --- /dev/null
210 212 +++ b/1
211 213 @@ -0,0 +1,1 @@
212 214 +1
213 215 0: [mq]: 1.patch - test - 3.00
214 216 ==== qref -d
215 217 Date: 4 0
216 218
217 219 diff -r ... 1
218 220 --- /dev/null
219 221 +++ b/1
220 222 @@ -0,0 +1,1 @@
221 223 +1
222 224 0: [mq]: 1.patch - test - 4.00
223 225 ==== qnew
224 226 adding 2
225 227 diff -r ... 2
226 228 --- /dev/null
227 229 +++ b/2
228 230 @@ -0,0 +1,1 @@
229 231 +2
230 232 1: [mq]: 2.patch - test
231 233 0: [mq]: 1.patch - test
232 234 ==== qref -d
233 235 Date: 5 0
234 236
235 237 diff -r ... 2
236 238 --- /dev/null
237 239 +++ b/2
238 240 @@ -0,0 +1,1 @@
239 241 +2
240 242 1: [mq]: 2.patch - test
241 243 0: [mq]: 1.patch - test
242 244 popping 2.patch
243 245 now at: 1.patch
244 246 ==== qnew -d -m
245 247 Date: 6 0
246 248 Three
247 249
248 250 1: Three - test - 6.00
249 251 0: [mq]: 1.patch - test - 4.00
250 252 ==== qref
251 253 adding 3
252 254 Date: 6 0
253 255 Three
254 256
255 257 diff -r ... 3
256 258 --- /dev/null
257 259 +++ b/3
258 260 @@ -0,0 +1,1 @@
259 261 +3
260 262 1: Three - test - 6.00
261 263 0: [mq]: 1.patch - test - 4.00
262 264 ==== qref -m
263 265 Date: 6 0
264 266 Drei
265 267
266 268 diff -r ... 3
267 269 --- /dev/null
268 270 +++ b/3
269 271 @@ -0,0 +1,1 @@
270 272 +3
271 273 1: Drei - test - 6.00
272 274 0: [mq]: 1.patch - test - 4.00
273 275 ==== qref -d
274 276 Date: 7 0
275 277 Drei
276 278
277 279 diff -r ... 3
278 280 --- /dev/null
279 281 +++ b/3
280 282 @@ -0,0 +1,1 @@
281 283 +3
282 284 1: Drei - test - 7.00
283 285 0: [mq]: 1.patch - test - 4.00
284 286 ==== qref -d -m
285 287 Date: 8 0
286 288 Three (again)
287 289
288 290 diff -r ... 3
289 291 --- /dev/null
290 292 +++ b/3
291 293 @@ -0,0 +1,1 @@
292 294 +3
293 295 1: Three (again) - test - 8.00
294 296 0: [mq]: 1.patch - test - 4.00
295 297 ==== qnew -m
296 298 adding 4
297 299 Four
298 300
299 301 diff -r ... 4
300 302 --- /dev/null
301 303 +++ b/4
302 304 @@ -0,0 +1,1 @@
303 305 +4
304 306 2: Four - test
305 307 1: Three (again) - test
306 308 0: [mq]: 1.patch - test
307 309 ==== qref -d
308 310 Date: 9 0
309 311 Four
310 312
311 313 diff -r ... 4
312 314 --- /dev/null
313 315 +++ b/4
314 316 @@ -0,0 +1,1 @@
315 317 +4
316 318 2: Four - test
317 319 1: Three (again) - test
318 320 0: [mq]: 1.patch - test
319 321 popping 4.patch
320 322 now at: 3.patch
321 323 ==== qnew with HG header
322 324 popping 5.patch
323 325 now at: 3.patch
324 326 # HG changeset patch
325 327 # Date 10 0
326 328 2: imported patch 5.patch - test - 10.00
327 329 1: Three (again) - test - 8.00
328 330 0: [mq]: 1.patch - test - 4.00
329 331 ==== hg qref
330 332 adding 5
331 333 # HG changeset patch
332 334 # Date 10 0
333 335 # Parent
334 336
335 337 diff -r ... 5
336 338 --- /dev/null
337 339 +++ b/5
338 340 @@ -0,0 +1,1 @@
339 341 +5
340 342 2: [mq]: 5.patch - test - 10.00
341 343 1: Three (again) - test - 8.00
342 344 0: [mq]: 1.patch - test - 4.00
343 345 ==== hg qref -d
344 346 # HG changeset patch
345 347 # Date 11 0
346 348 # Parent
347 349
348 350 diff -r ... 5
349 351 --- /dev/null
350 352 +++ b/5
351 353 @@ -0,0 +1,1 @@
352 354 +5
353 355 2: [mq]: 5.patch - test - 11.00
354 356 1: Three (again) - test - 8.00
355 357 0: [mq]: 1.patch - test - 4.00
356 358 ==== qnew with plain header
357 359 popping 6.patch
358 360 now at: 5.patch
359 361 now at: 6.patch
360 362 Date: 12 0
361 363
362 364 3: imported patch 6.patch - test
363 365 2: [mq]: 5.patch - test
364 366 1: Three (again) - test
365 367 0: [mq]: 1.patch - test
366 368 ==== hg qref
367 369 adding 6
368 370 Date: 12 0
369 371
370 372 diff -r ... 6
371 373 --- /dev/null
372 374 +++ b/6
373 375 @@ -0,0 +1,1 @@
374 376 +6
375 377 3: [mq]: 6.patch - test - 12.00
376 378 2: [mq]: 5.patch - test - 11.00
377 379 1: Three (again) - test - 8.00
378 380 0: [mq]: 1.patch - test - 4.00
379 381 ==== hg qref -d
380 382 Date: 13 0
381 383
382 384 diff -r ... 6
383 385 --- /dev/null
384 386 +++ b/6
385 387 @@ -0,0 +1,1 @@
386 388 +6
387 389 3: [mq]: 6.patch - test - 13.00
388 390 2: [mq]: 5.patch - test - 11.00
389 391 1: Three (again) - test - 8.00
390 392 0: [mq]: 1.patch - test - 4.00
391 393 popping 6.patch
392 394 now at: 5.patch
393 395 ==== qnew -u
394 396 adding 6
395 397 From: jane
396 398
397 399 diff -r ... 6
398 400 --- /dev/null
399 401 +++ b/6
400 402 @@ -0,0 +1,1 @@
401 403 +6
402 404 3: [mq]: 6.patch - jane
403 405 2: [mq]: 5.patch - test
404 406 1: Three (again) - test
405 407 0: [mq]: 1.patch - test
406 408 ==== qref -d
407 409 Date: 12 0
408 410 From: jane
409 411
410 412 diff -r ... 6
411 413 --- /dev/null
412 414 +++ b/6
413 415 @@ -0,0 +1,1 @@
414 416 +6
415 417 3: [mq]: 6.patch - jane
416 418 2: [mq]: 5.patch - test
417 419 1: Three (again) - test
418 420 0: [mq]: 1.patch - test
419 421 popping 6.patch
420 422 now at: 5.patch
421 423 ==== qnew -d
422 424 adding 7
423 425 Date: 13 0
424 426
425 427 diff -r ... 7
426 428 --- /dev/null
427 429 +++ b/7
428 430 @@ -0,0 +1,1 @@
429 431 +7
430 432 3: [mq]: 7.patch - test
431 433 2: [mq]: 5.patch - test
432 434 1: Three (again) - test
433 435 0: [mq]: 1.patch - test
434 436 ==== qref -u
435 437 From: john
436 438 Date: 13 0
437 439
438 440 diff -r ... 7
439 441 --- /dev/null
440 442 +++ b/7
441 443 @@ -0,0 +1,1 @@
442 444 +7
443 445 3: [mq]: 7.patch - john - 13.00
444 446 2: [mq]: 5.patch - test - 11.00
445 447 1: Three (again) - test - 8.00
446 448 0: [mq]: 1.patch - test - 4.00
447 449 ==== qnew
448 450 adding 8
449 451 diff -r ... 8
450 452 --- /dev/null
451 453 +++ b/8
452 454 @@ -0,0 +1,1 @@
453 455 +8
454 456 4: [mq]: 8.patch - test
455 457 3: [mq]: 7.patch - john
456 458 2: [mq]: 5.patch - test
457 459 1: Three (again) - test
458 460 0: [mq]: 1.patch - test
459 461 ==== qref -u -d
460 462 Date: 14 0
461 463 From: john
462 464
463 465 diff -r ... 8
464 466 --- /dev/null
465 467 +++ b/8
466 468 @@ -0,0 +1,1 @@
467 469 +8
468 470 4: [mq]: 8.patch - john
469 471 3: [mq]: 7.patch - john
470 472 2: [mq]: 5.patch - test
471 473 1: Three (again) - test
472 474 0: [mq]: 1.patch - test
473 475 popping 8.patch
474 476 now at: 7.patch
475 477 ==== qnew -m
476 478 adding 9
477 479 Nine
478 480
479 481 diff -r ... 9
480 482 --- /dev/null
481 483 +++ b/9
482 484 @@ -0,0 +1,1 @@
483 485 +9
484 486 4: Nine - test
485 487 3: [mq]: 7.patch - john
486 488 2: [mq]: 5.patch - test
487 489 1: Three (again) - test
488 490 0: [mq]: 1.patch - test
489 491 ==== qref -u -d
490 492 Date: 15 0
491 493 From: john
492 494 Nine
493 495
494 496 diff -r ... 9
495 497 --- /dev/null
496 498 +++ b/9
497 499 @@ -0,0 +1,1 @@
498 500 +9
499 501 4: Nine - john
500 502 3: [mq]: 7.patch - john
501 503 2: [mq]: 5.patch - test
502 504 1: Three (again) - test
503 505 0: [mq]: 1.patch - test
504 506 popping 9.patch
505 507 now at: 7.patch
506 508 ==== qpop -a / qpush -a
507 509 popping 7.patch
508 510 popping 5.patch
509 511 popping 3.patch
510 512 popping 1.patch
511 513 patch queue now empty
512 514 applying 1.patch
513 515 applying 3.patch
514 516 applying 5.patch
515 517 applying 7.patch
516 518 now at: 7.patch
517 519 3: imported patch 7.patch - john - 13.00
518 520 2: imported patch 5.patch - test - 11.00
519 521 1: Three (again) - test - 8.00
520 522 0: imported patch 1.patch - test - 4.00
521 523 $ rm -r sandbox
522 524
523 525 ======= hg headers
524 526
525 527 $ echo "plain=false" >> $HGRCPATH
526 528 $ mkdir sandbox
527 529 $ (cd sandbox ; runtest)
528 530 ==== init
529 531 ==== qnew -d
530 532 # HG changeset patch
531 533 # Date 3 0
532 534 # Parent
533 535
534 536 0: [mq]: 1.patch - test - 3.00
535 537 ==== qref
536 538 adding 1
537 539 # HG changeset patch
538 540 # Date 3 0
539 541 # Parent
540 542
541 543 diff -r ... 1
542 544 --- /dev/null
543 545 +++ b/1
544 546 @@ -0,0 +1,1 @@
545 547 +1
546 548 0: [mq]: 1.patch - test - 3.00
547 549 ==== qref -d
548 550 # HG changeset patch
549 551 # Date 4 0
550 552 # Parent
551 553
552 554 diff -r ... 1
553 555 --- /dev/null
554 556 +++ b/1
555 557 @@ -0,0 +1,1 @@
556 558 +1
557 559 0: [mq]: 1.patch - test - 4.00
558 560 ==== qnew
559 561 adding 2
560 562 # HG changeset patch
561 563 # Parent
562 564
563 565 diff -r ... 2
564 566 --- /dev/null
565 567 +++ b/2
566 568 @@ -0,0 +1,1 @@
567 569 +2
568 570 1: [mq]: 2.patch - test
569 571 0: [mq]: 1.patch - test
570 572 ==== qref -d
571 573 # HG changeset patch
572 574 # Date 5 0
573 575 # Parent
574 576
575 577 diff -r ... 2
576 578 --- /dev/null
577 579 +++ b/2
578 580 @@ -0,0 +1,1 @@
579 581 +2
580 582 1: [mq]: 2.patch - test
581 583 0: [mq]: 1.patch - test
582 584 popping 2.patch
583 585 now at: 1.patch
584 586 ==== qnew -d -m
585 587 # HG changeset patch
586 588 # Date 6 0
587 589 # Parent
588 590 Three
589 591
590 592 1: Three - test - 6.00
591 593 0: [mq]: 1.patch - test - 4.00
592 594 ==== qref
593 595 adding 3
594 596 # HG changeset patch
595 597 # Date 6 0
596 598 # Parent
597 599 Three
598 600
599 601 diff -r ... 3
600 602 --- /dev/null
601 603 +++ b/3
602 604 @@ -0,0 +1,1 @@
603 605 +3
604 606 1: Three - test - 6.00
605 607 0: [mq]: 1.patch - test - 4.00
606 608 ==== qref -m
607 609 # HG changeset patch
608 610 # Date 6 0
609 611 # Parent
610 612 Drei
611 613
612 614 diff -r ... 3
613 615 --- /dev/null
614 616 +++ b/3
615 617 @@ -0,0 +1,1 @@
616 618 +3
617 619 1: Drei - test - 6.00
618 620 0: [mq]: 1.patch - test - 4.00
619 621 ==== qref -d
620 622 # HG changeset patch
621 623 # Date 7 0
622 624 # Parent
623 625 Drei
624 626
625 627 diff -r ... 3
626 628 --- /dev/null
627 629 +++ b/3
628 630 @@ -0,0 +1,1 @@
629 631 +3
630 632 1: Drei - test - 7.00
631 633 0: [mq]: 1.patch - test - 4.00
632 634 ==== qref -d -m
633 635 # HG changeset patch
634 636 # Date 8 0
635 637 # Parent
636 638 Three (again)
637 639
638 640 diff -r ... 3
639 641 --- /dev/null
640 642 +++ b/3
641 643 @@ -0,0 +1,1 @@
642 644 +3
643 645 1: Three (again) - test - 8.00
644 646 0: [mq]: 1.patch - test - 4.00
645 647 ==== qnew -m
646 648 adding 4
647 649 # HG changeset patch
648 650 # Parent
649 651 Four
650 652
651 653 diff -r ... 4
652 654 --- /dev/null
653 655 +++ b/4
654 656 @@ -0,0 +1,1 @@
655 657 +4
656 658 2: Four - test
657 659 1: Three (again) - test
658 660 0: [mq]: 1.patch - test
659 661 ==== qref -d
660 662 # HG changeset patch
661 663 # Date 9 0
662 664 # Parent
663 665 Four
664 666
665 667 diff -r ... 4
666 668 --- /dev/null
667 669 +++ b/4
668 670 @@ -0,0 +1,1 @@
669 671 +4
670 672 2: Four - test
671 673 1: Three (again) - test
672 674 0: [mq]: 1.patch - test
673 675 popping 4.patch
674 676 now at: 3.patch
675 677 ==== qnew with HG header
676 678 popping 5.patch
677 679 now at: 3.patch
678 680 # HG changeset patch
679 681 # Date 10 0
680 682 2: imported patch 5.patch - test - 10.00
681 683 1: Three (again) - test - 8.00
682 684 0: [mq]: 1.patch - test - 4.00
683 685 ==== hg qref
684 686 adding 5
685 687 # HG changeset patch
686 688 # Date 10 0
687 689 # Parent
688 690
689 691 diff -r ... 5
690 692 --- /dev/null
691 693 +++ b/5
692 694 @@ -0,0 +1,1 @@
693 695 +5
694 696 2: [mq]: 5.patch - test - 10.00
695 697 1: Three (again) - test - 8.00
696 698 0: [mq]: 1.patch - test - 4.00
697 699 ==== hg qref -d
698 700 # HG changeset patch
699 701 # Date 11 0
700 702 # Parent
701 703
702 704 diff -r ... 5
703 705 --- /dev/null
704 706 +++ b/5
705 707 @@ -0,0 +1,1 @@
706 708 +5
707 709 2: [mq]: 5.patch - test - 11.00
708 710 1: Three (again) - test - 8.00
709 711 0: [mq]: 1.patch - test - 4.00
710 712 ==== qnew with plain header
711 713 popping 6.patch
712 714 now at: 5.patch
713 715 now at: 6.patch
714 716 Date: 12 0
715 717
716 718 3: imported patch 6.patch - test
717 719 2: [mq]: 5.patch - test
718 720 1: Three (again) - test
719 721 0: [mq]: 1.patch - test
720 722 ==== hg qref
721 723 adding 6
722 724 Date: 12 0
723 725
724 726 diff -r ... 6
725 727 --- /dev/null
726 728 +++ b/6
727 729 @@ -0,0 +1,1 @@
728 730 +6
729 731 3: [mq]: 6.patch - test - 12.00
730 732 2: [mq]: 5.patch - test - 11.00
731 733 1: Three (again) - test - 8.00
732 734 0: [mq]: 1.patch - test - 4.00
733 735 ==== hg qref -d
734 736 Date: 13 0
735 737
736 738 diff -r ... 6
737 739 --- /dev/null
738 740 +++ b/6
739 741 @@ -0,0 +1,1 @@
740 742 +6
741 743 3: [mq]: 6.patch - test - 13.00
742 744 2: [mq]: 5.patch - test - 11.00
743 745 1: Three (again) - test - 8.00
744 746 0: [mq]: 1.patch - test - 4.00
745 747 popping 6.patch
746 748 now at: 5.patch
747 749 ==== qnew -u
748 750 adding 6
749 751 # HG changeset patch
750 752 # User jane
751 753 # Parent
752 754
753 755 diff -r ... 6
754 756 --- /dev/null
755 757 +++ b/6
756 758 @@ -0,0 +1,1 @@
757 759 +6
758 760 3: [mq]: 6.patch - jane
759 761 2: [mq]: 5.patch - test
760 762 1: Three (again) - test
761 763 0: [mq]: 1.patch - test
762 764 ==== qref -d
763 765 # HG changeset patch
764 766 # User jane
765 767 # Date 12 0
766 768 # Parent
767 769
768 770 diff -r ... 6
769 771 --- /dev/null
770 772 +++ b/6
771 773 @@ -0,0 +1,1 @@
772 774 +6
773 775 3: [mq]: 6.patch - jane
774 776 2: [mq]: 5.patch - test
775 777 1: Three (again) - test
776 778 0: [mq]: 1.patch - test
777 779 popping 6.patch
778 780 now at: 5.patch
779 781 ==== qnew -d
780 782 adding 7
781 783 # HG changeset patch
782 784 # Date 13 0
783 785 # Parent
784 786
785 787 diff -r ... 7
786 788 --- /dev/null
787 789 +++ b/7
788 790 @@ -0,0 +1,1 @@
789 791 +7
790 792 3: [mq]: 7.patch - test
791 793 2: [mq]: 5.patch - test
792 794 1: Three (again) - test
793 795 0: [mq]: 1.patch - test
794 796 ==== qref -u
795 797 # HG changeset patch
796 798 # User john
797 799 # Date 13 0
798 800 # Parent
799 801
800 802 diff -r ... 7
801 803 --- /dev/null
802 804 +++ b/7
803 805 @@ -0,0 +1,1 @@
804 806 +7
805 807 3: [mq]: 7.patch - john - 13.00
806 808 2: [mq]: 5.patch - test - 11.00
807 809 1: Three (again) - test - 8.00
808 810 0: [mq]: 1.patch - test - 4.00
809 811 ==== qnew
810 812 adding 8
811 813 # HG changeset patch
812 814 # Parent
813 815
814 816 diff -r ... 8
815 817 --- /dev/null
816 818 +++ b/8
817 819 @@ -0,0 +1,1 @@
818 820 +8
819 821 4: [mq]: 8.patch - test
820 822 3: [mq]: 7.patch - john
821 823 2: [mq]: 5.patch - test
822 824 1: Three (again) - test
823 825 0: [mq]: 1.patch - test
824 826 ==== qref -u -d
825 827 # HG changeset patch
826 828 # User john
827 829 # Date 14 0
828 830 # Parent
829 831
830 832 diff -r ... 8
831 833 --- /dev/null
832 834 +++ b/8
833 835 @@ -0,0 +1,1 @@
834 836 +8
835 837 4: [mq]: 8.patch - john
836 838 3: [mq]: 7.patch - john
837 839 2: [mq]: 5.patch - test
838 840 1: Three (again) - test
839 841 0: [mq]: 1.patch - test
840 842 popping 8.patch
841 843 now at: 7.patch
842 844 ==== qnew -m
843 845 adding 9
844 846 # HG changeset patch
845 847 # Parent
846 848 Nine
847 849
848 850 diff -r ... 9
849 851 --- /dev/null
850 852 +++ b/9
851 853 @@ -0,0 +1,1 @@
852 854 +9
853 855 4: Nine - test
854 856 3: [mq]: 7.patch - john
855 857 2: [mq]: 5.patch - test
856 858 1: Three (again) - test
857 859 0: [mq]: 1.patch - test
858 860 ==== qref -u -d
859 861 # HG changeset patch
860 862 # User john
861 863 # Date 15 0
862 864 # Parent
863 865 Nine
864 866
865 867 diff -r ... 9
866 868 --- /dev/null
867 869 +++ b/9
868 870 @@ -0,0 +1,1 @@
869 871 +9
870 872 4: Nine - john
871 873 3: [mq]: 7.patch - john
872 874 2: [mq]: 5.patch - test
873 875 1: Three (again) - test
874 876 0: [mq]: 1.patch - test
875 877 popping 9.patch
876 878 now at: 7.patch
877 879 ==== qpop -a / qpush -a
878 880 popping 7.patch
879 881 popping 5.patch
880 882 popping 3.patch
881 883 popping 1.patch
882 884 patch queue now empty
883 885 applying 1.patch
884 886 applying 3.patch
885 887 applying 5.patch
886 888 applying 7.patch
887 889 now at: 7.patch
888 890 3: imported patch 7.patch - john - 13.00
889 891 2: imported patch 5.patch - test - 11.00
890 892 1: Three (again) - test - 8.00
891 893 0: imported patch 1.patch - test - 4.00
892 894 $ rm -r sandbox
@@ -1,175 +1,177 b''
1 1 Setup extension:
2 2
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq =" >> $HGRCPATH
5 $ echo "[mq]" >> $HGRCPATH
6 $ echo "git = keep" >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
5 > mq =
6 > [mq]
7 > git = keep
8 > EOF
7 9
8 10 Test merge with mq changeset as the second parent:
9 11
10 12 $ hg init m
11 13 $ cd m
12 14 $ touch a b c
13 15 $ hg add a
14 16 $ hg commit -m a
15 17 $ hg add b
16 18 $ hg qnew -d "0 0" b
17 19 $ hg update 0
18 20 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
19 21 $ hg add c
20 22 $ hg commit -m c
21 23 created new head
22 24 $ hg merge
23 25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 26 (branch merge, don't forget to commit)
25 27 $ hg commit -m merge
26 28 abort: cannot commit over an applied mq patch
27 29 [255]
28 30 $ cd ..
29 31
30 32 Issue529: mq aborts when merging patch deleting files
31 33
32 34 $ checkundo()
33 35 > {
34 36 > if [ -f .hg/store/undo ]; then
35 37 > echo ".hg/store/undo still exists"
36 38 > fi
37 39 > }
38 40
39 41 Commit two dummy files in "init" changeset:
40 42
41 43 $ hg init t
42 44 $ cd t
43 45 $ echo a > a
44 46 $ echo b > b
45 47 $ hg ci -Am init
46 48 adding a
47 49 adding b
48 50 $ hg tag -l init
49 51
50 52 Create a patch removing a:
51 53
52 54 $ hg qnew rm_a
53 55 $ hg rm a
54 56 $ hg qrefresh -m "rm a"
55 57
56 58 Save the patch queue so we can merge it later:
57 59
58 60 $ hg qsave -c -e
59 61 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1 (glob)
60 62 $ checkundo
61 63
62 64 Update b and commit in an "update" changeset:
63 65
64 66 $ hg up -C init
65 67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 68 $ echo b >> b
67 69 $ hg st
68 70 M b
69 71 $ hg ci -m update
70 72 created new head
71 73
72 74 # Here, qpush used to abort with :
73 75 # The system cannot find the file specified => a
74 76 $ hg manifest
75 77 a
76 78 b
77 79
78 80 $ hg qpush -a -m
79 81 merging with queue at: $TESTTMP/t/.hg/patches.1 (glob)
80 82 applying rm_a
81 83 now at: rm_a
82 84
83 85 $ checkundo
84 86 $ hg manifest
85 87 b
86 88
87 89 Ensure status is correct after merge:
88 90
89 91 $ hg qpop -a
90 92 popping rm_a
91 93 popping .hg.patches.merge.marker
92 94 patch queue now empty
93 95
94 96 $ cd ..
95 97
96 98 Classic MQ merge sequence *with an explicit named queue*:
97 99
98 100 $ hg init t2
99 101 $ cd t2
100 102 $ echo '[diff]' > .hg/hgrc
101 103 $ echo 'nodates = 1' >> .hg/hgrc
102 104 $ echo a > a
103 105 $ hg ci -Am init
104 106 adding a
105 107 $ echo b > a
106 108 $ hg ci -m changea
107 109 $ hg up -C 0
108 110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 111 $ hg cp a aa
110 112 $ echo c >> a
111 113 $ hg qnew --git -f -e patcha
112 114 $ echo d >> a
113 115 $ hg qnew -d '0 0' -f -e patcha2
114 116
115 117 Create the reference queue:
116 118
117 119 $ hg qsave -c -e -n refqueue
118 120 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue (glob)
119 121 $ hg up -C 1
120 122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
121 123
122 124 Merge:
123 125
124 126 $ HGMERGE=internal:other hg qpush -a -m -n refqueue
125 127 merging with queue at: $TESTTMP/t2/.hg/refqueue (glob)
126 128 applying patcha
127 129 patching file a
128 130 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
129 131 fuzz found when applying patch, stopping
130 132 patch didn't work out, merging patcha
131 133 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 134 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
133 135 (branch merge, don't forget to commit)
134 136 applying patcha2
135 137 now at: patcha2
136 138
137 139 Check patcha is still a git patch:
138 140
139 141 $ cat .hg/patches/patcha
140 142 # HG changeset patch
141 143 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
142 144
143 145 diff --git a/a b/a
144 146 --- a/a
145 147 +++ b/a
146 148 @@ -1,1 +1,2 @@
147 149 -b
148 150 +a
149 151 +c
150 152 diff --git a/a b/aa
151 153 copy from a
152 154 copy to aa
153 155 --- a/a
154 156 +++ b/aa
155 157 @@ -1,1 +1,1 @@
156 158 -b
157 159 +a
158 160
159 161 Check patcha2 is still a regular patch:
160 162
161 163 $ cat .hg/patches/patcha2
162 164 # HG changeset patch
163 165 # Date 0 0
164 166 # Parent ???????????????????????????????????????? (glob)
165 167
166 168 diff -r ???????????? -r ???????????? a (glob)
167 169 --- a/a
168 170 +++ b/a
169 171 @@ -1,2 +1,3 @@
170 172 a
171 173 c
172 174 +d
173 175
174 176 $ cd ..
175 177
@@ -1,177 +1,179 b''
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > mq =
4 > [mq]
5 > git = keep
6 > EOF
5 7
6 8 $ hg init a
7 9 $ cd a
8 10
9 11 $ echo 'base' > base
10 12 $ hg ci -Ambase
11 13 adding base
12 14
13 15 $ hg qnew -mmqbase mqbase
14 16
15 17 $ echo 'patched' > base
16 18 $ hg qrefresh
17 19
18 20 qdiff:
19 21
20 22 $ hg qdiff
21 23 diff -r d20a80d4def3 base
22 24 --- a/base Thu Jan 01 00:00:00 1970 +0000
23 25 +++ b/base* (glob)
24 26 @@ -1,1 +1,1 @@
25 27 -base
26 28 +patched
27 29
28 30 qdiff dirname:
29 31
30 32 $ hg qdiff --nodates .
31 33 diff -r d20a80d4def3 base
32 34 --- a/base
33 35 +++ b/base
34 36 @@ -1,1 +1,1 @@
35 37 -base
36 38 +patched
37 39
38 40 qdiff filename:
39 41
40 42 $ hg qdiff --nodates base
41 43 diff -r d20a80d4def3 base
42 44 --- a/base
43 45 +++ b/base
44 46 @@ -1,1 +1,1 @@
45 47 -base
46 48 +patched
47 49
48 50 $ hg revert -a
49 51
50 52 $ hg qpop
51 53 popping mqbase
52 54 patch queue now empty
53 55
54 56 $ hg qdelete mqbase
55 57
56 58 $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
57 59 $ hg ci -Amlines -d '2 0'
58 60 adding lines
59 61
60 62 $ hg qnew -mmqbase2 mqbase2
61 63 $ printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines
62 64
63 65 $ hg qdiff --nodates -U 1
64 66 diff -r b0c220e1cf43 lines
65 67 --- a/lines
66 68 +++ b/lines
67 69 @@ -1,1 +1,3 @@
68 70 +
69 71 +
70 72 1
71 73 @@ -4,4 +6,4 @@
72 74 4
73 75 -hello world
74 76 -goodbye world
75 77 +hello world
76 78 + goodbye world
77 79 7
78 80
79 81 $ hg qdiff --nodates -b
80 82 diff -r b0c220e1cf43 lines
81 83 --- a/lines
82 84 +++ b/lines
83 85 @@ -1,9 +1,11 @@
84 86 +
85 87 +
86 88 1
87 89 2
88 90 3
89 91 4
90 92 hello world
91 93 -goodbye world
92 94 + goodbye world
93 95 7
94 96 8
95 97 9
96 98
97 99 $ hg qdiff --nodates -U 1 -B
98 100 diff -r b0c220e1cf43 lines
99 101 --- a/lines
100 102 +++ b/lines
101 103 @@ -4,4 +4,4 @@
102 104 4
103 105 -hello world
104 106 -goodbye world
105 107 +hello world
106 108 + goodbye world
107 109 7
108 110
109 111 $ hg qdiff --nodates -w
110 112 diff -r b0c220e1cf43 lines
111 113 --- a/lines
112 114 +++ b/lines
113 115 @@ -1,3 +1,5 @@
114 116 +
115 117 +
116 118 1
117 119 2
118 120 3
119 121
120 122 $ hg qdiff --nodates --reverse
121 123 diff -r b0c220e1cf43 lines
122 124 --- a/lines
123 125 +++ b/lines
124 126 @@ -1,11 +1,9 @@
125 127 -
126 128 -
127 129 1
128 130 2
129 131 3
130 132 4
131 133 -hello world
132 134 - goodbye world
133 135 +hello world
134 136 +goodbye world
135 137 7
136 138 8
137 139 9
138 140
139 141 qdiff preserve existing git flag:
140 142
141 143 $ hg qrefresh --git
142 144 $ echo a >> lines
143 145 $ hg qdiff
144 146 diff --git a/lines b/lines
145 147 --- a/lines
146 148 +++ b/lines
147 149 @@ -1,9 +1,12 @@
148 150 +
149 151 +
150 152 1
151 153 2
152 154 3
153 155 4
154 156 -hello world
155 157 -goodbye world
156 158 +hello world
157 159 + goodbye world
158 160 7
159 161 8
160 162 9
161 163 +a
162 164
163 165 $ hg qdiff --stat
164 166 lines | 7 +++++--
165 167 1 files changed, 5 insertions(+), 2 deletions(-)
166 168 $ hg qrefresh
167 169
168 170 qdiff when file deleted (but not removed) in working dir:
169 171
170 172 $ hg qnew deleted-file
171 173 $ echo a > newfile
172 174 $ hg add newfile
173 175 $ hg qrefresh
174 176 $ rm newfile
175 177 $ hg qdiff
176 178
177 179 $ cd ..
@@ -1,261 +1,263 b''
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > mq =
4 > [mq]
5 > git = keep
6 > [diff]
7 > nodates = 1
8 > EOF
7 9
8 10 init:
9 11
10 12 $ hg init repo
11 13 $ cd repo
12 14 $ echo a > a
13 15 $ hg ci -Am adda
14 16 adding a
15 17 $ echo a >> a
16 18 $ hg qnew -f p1
17 19 $ echo b >> a
18 20 $ hg qnew -f p2
19 21 $ echo c >> a
20 22 $ hg qnew -f p3
21 23
22 24 Fold in the middle of the queue:
23 25 (this tests also that editor is not invoked if '--edit' is not
24 26 specified)
25 27
26 28 $ hg qpop p1
27 29 popping p3
28 30 popping p2
29 31 now at: p1
30 32
31 33 $ hg qdiff
32 34 diff -r 07f494440405 a
33 35 --- a/a
34 36 +++ b/a
35 37 @@ -1,1 +1,2 @@
36 38 a
37 39 +a
38 40
39 41 $ HGEDITOR=cat hg qfold p2
40 42 $ grep git .hg/patches/p1 && echo 'git patch found!'
41 43 [1]
42 44
43 45 $ hg qser
44 46 p1
45 47 p3
46 48
47 49 $ hg qdiff
48 50 diff -r 07f494440405 a
49 51 --- a/a
50 52 +++ b/a
51 53 @@ -1,1 +1,3 @@
52 54 a
53 55 +a
54 56 +b
55 57
56 58 Fold with local changes:
57 59
58 60 $ echo d >> a
59 61 $ hg qfold p3
60 62 abort: local changes found, refresh first
61 63 [255]
62 64
63 65 $ hg diff -c .
64 66 diff -r 07f494440405 -r ???????????? a (glob)
65 67 --- a/a
66 68 +++ b/a
67 69 @@ -1,1 +1,3 @@
68 70 a
69 71 +a
70 72 +b
71 73
72 74 $ hg revert -a --no-backup
73 75 reverting a
74 76
75 77 Fold git patch into a regular patch, expect git patch:
76 78
77 79 $ echo a >> a
78 80 $ hg qnew -f regular
79 81 $ hg cp a aa
80 82 $ hg qnew --git -f git
81 83
82 84 $ hg qpop
83 85 popping git
84 86 now at: regular
85 87
86 88 $ hg qfold git
87 89
88 90 $ cat .hg/patches/regular
89 91 # HG changeset patch
90 92 # Parent ???????????????????????????????????????? (glob)
91 93
92 94 diff --git a/a b/a
93 95 --- a/a
94 96 +++ b/a
95 97 @@ -1,3 +1,4 @@
96 98 a
97 99 a
98 100 b
99 101 +a
100 102 diff --git a/a b/aa
101 103 copy from a
102 104 copy to aa
103 105 --- a/a
104 106 +++ b/aa
105 107 @@ -1,3 +1,4 @@
106 108 a
107 109 a
108 110 b
109 111 +a
110 112
111 113 $ hg qpop
112 114 popping regular
113 115 now at: p1
114 116
115 117 $ hg qdel regular
116 118
117 119 Fold regular patch into a git patch, expect git patch:
118 120
119 121 $ hg cp a aa
120 122 $ hg qnew --git -f git
121 123 $ echo b >> aa
122 124 $ hg qnew -f regular
123 125
124 126 $ hg qpop
125 127 popping regular
126 128 now at: git
127 129
128 130 $ hg qfold regular
129 131
130 132 $ cat .hg/patches/git
131 133 # HG changeset patch
132 134 # Parent ???????????????????????????????????????? (glob)
133 135
134 136 diff --git a/a b/aa
135 137 copy from a
136 138 copy to aa
137 139 --- a/a
138 140 +++ b/aa
139 141 @@ -1,3 +1,4 @@
140 142 a
141 143 a
142 144 b
143 145 +b
144 146
145 147 Test saving last-message.txt:
146 148
147 149 $ hg qrefresh -m "original message"
148 150
149 151 $ cat > $TESTTMP/commitfailure.py <<EOF
150 152 > from mercurial import util
151 153 > def reposetup(ui, repo):
152 154 > class commitfailure(repo.__class__):
153 155 > def commit(self, *args, **kwargs):
154 156 > raise util.Abort('emulating unexpected abort')
155 157 > repo.__class__ = commitfailure
156 158 > EOF
157 159
158 160 $ cat >> .hg/hgrc <<EOF
159 161 > [extensions]
160 162 > # this failure occurs before editor invocation
161 163 > commitfailure = $TESTTMP/commitfailure.py
162 164 > EOF
163 165
164 166 $ cat > $TESTTMP/editor.sh << EOF
165 167 > echo "==== before editing"
166 168 > cat \$1
167 169 > echo "===="
168 170 > (echo; echo "test saving last-message.txt") >> \$1
169 171 > EOF
170 172
171 173 $ hg qapplied
172 174 p1
173 175 git
174 176 $ hg tip --template "{files}\n"
175 177 aa
176 178
177 179 (test that editor is not invoked before transaction starting,
178 180 and that combination of '--edit' and '--message' doesn't abort execution)
179 181
180 182 $ rm -f .hg/last-message.txt
181 183 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e -m MESSAGE p3
182 184 refresh interrupted while patch was popped! (revert --all, qpush to recover)
183 185 abort: emulating unexpected abort
184 186 [255]
185 187 $ test -f .hg/last-message.txt
186 188 [1]
187 189
188 190 (reset applied patches and directory status)
189 191
190 192 $ cat >> .hg/hgrc <<EOF
191 193 > [extensions]
192 194 > # this failure occurs after editor invocation
193 195 > commitfailure = !
194 196 > EOF
195 197
196 198 $ hg qapplied
197 199 p1
198 200 $ hg status -A aa
199 201 ? aa
200 202 $ rm aa
201 203 $ hg status -m
202 204 M a
203 205 $ hg revert --no-backup -q a
204 206 $ hg qpush -q git
205 207 now at: git
206 208
207 209 (test that editor is invoked and commit message is saved into
208 210 "last-message.txt")
209 211
210 212 $ cat >> .hg/hgrc <<EOF
211 213 > [hooks]
212 214 > # this failure occurs after editor invocation
213 215 > pretxncommit.unexpectedabort = false
214 216 > EOF
215 217
216 218 $ rm -f .hg/last-message.txt
217 219 $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
218 220 ==== before editing
219 221 original message
220 222
221 223
222 224 HG: Enter commit message. Lines beginning with 'HG:' are removed.
223 225 HG: Leave message empty to use default message.
224 226 HG: --
225 227 HG: user: test
226 228 HG: branch 'default'
227 229 HG: added aa
228 230 HG: changed a
229 231 ====
230 232 transaction abort!
231 233 rollback completed
232 234 note: commit message saved in .hg/last-message.txt
233 235 refresh interrupted while patch was popped! (revert --all, qpush to recover)
234 236 abort: pretxncommit.unexpectedabort hook exited with status 1
235 237 [255]
236 238 $ cat .hg/last-message.txt
237 239 original message
238 240
239 241
240 242
241 243 test saving last-message.txt
242 244
243 245 (confirm whether files listed up in the commit message editing are correct)
244 246
245 247 $ cat >> .hg/hgrc <<EOF
246 248 > [hooks]
247 249 > pretxncommit.unexpectedabort =
248 250 > EOF
249 251 $ hg status -u | while read f; do rm ${f}; done
250 252 $ hg revert --no-backup -q --all
251 253 $ hg qpush -q git
252 254 now at: git
253 255 $ hg qpush -q --move p3
254 256 now at: p3
255 257
256 258 $ hg status --rev "git^1" --rev . -arm
257 259 M a
258 260 A aa
259 261
260 262 $ cd ..
261 263
@@ -1,290 +1,292 b''
1 1 #require killdaemons
2 2
3 3 $ cat > writelines.py <<EOF
4 4 > import sys
5 5 > path = sys.argv[1]
6 6 > args = sys.argv[2:]
7 7 > assert (len(args) % 2) == 0
8 8 >
9 9 > f = file(path, 'wb')
10 10 > for i in xrange(len(args)/2):
11 11 > count, s = args[2*i:2*i+2]
12 12 > count = int(count)
13 13 > s = s.decode('string_escape')
14 14 > f.write(s*count)
15 15 > f.close()
16 16 >
17 17 > EOF
18 $ echo "[extensions]" >> $HGRCPATH
19 $ echo "mq=" >> $HGRCPATH
20 $ echo "[diff]" >> $HGRCPATH
21 $ echo "git=1" >> $HGRCPATH
18 > cat <<EOF >> $HGRCPATH
19 > [extensions]
20 > mq =
21 > [diff]
22 > git = 1
23 > EOF
22 24 $ hg init repo
23 25 $ cd repo
24 26
25 27 qimport without file or revision
26 28
27 29 $ hg qimport
28 30 abort: no files or revisions specified
29 31 [255]
30 32
31 33 qimport non-existing-file
32 34
33 35 $ hg qimport non-existing-file
34 36 abort: unable to read file non-existing-file
35 37 [255]
36 38
37 39 qimport null revision
38 40
39 41 $ hg qimport -r null
40 42 abort: revision -1 is not mutable
41 43 (see "hg help phases" for details)
42 44 [255]
43 45 $ hg qseries
44 46
45 47 import email
46 48
47 49 $ hg qimport --push -n email - <<EOF
48 50 > From: Username in email <test@example.net>
49 51 > Subject: [PATCH] Message in email
50 52 > Date: Fri, 02 Jan 1970 00:00:00 +0000
51 53 >
52 54 > Text before patch.
53 55 >
54 56 > # HG changeset patch
55 57 > # User Username in patch <test@example.net>
56 58 > # Date 0 0
57 59 > # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
58 60 > # Parent 0000000000000000000000000000000000000000
59 61 > First line of commit message.
60 62 >
61 63 > More text in commit message.
62 64 > --- confuse the diff detection
63 65 >
64 66 > diff --git a/x b/x
65 67 > new file mode 100644
66 68 > --- /dev/null
67 69 > +++ b/x
68 70 > @@ -0,0 +1,1 @@
69 71 > +new file
70 72 > Text after patch.
71 73 >
72 74 > EOF
73 75 adding email to series file
74 76 applying email
75 77 now at: email
76 78
77 79 hg tip -v
78 80
79 81 $ hg tip -v
80 82 changeset: 0:1a706973a7d8
81 83 tag: email
82 84 tag: qbase
83 85 tag: qtip
84 86 tag: tip
85 87 user: Username in patch <test@example.net>
86 88 date: Thu Jan 01 00:00:00 1970 +0000
87 89 files: x
88 90 description:
89 91 First line of commit message.
90 92
91 93 More text in commit message.
92 94
93 95
94 96 $ hg qpop
95 97 popping email
96 98 patch queue now empty
97 99 $ hg qdelete email
98 100
99 101 import URL
100 102
101 103 $ echo foo >> foo
102 104 $ hg add foo
103 105 $ hg diff > url.diff
104 106 $ hg revert --no-backup foo
105 107 $ rm foo
106 108
107 109 Under unix: file:///foobar/blah
108 110 Under windows: file:///c:/foobar/blah
109 111
110 112 $ patchurl=`pwd | tr '\\\\' /`/url.diff
111 113 $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
112 114 $ hg qimport file://"$patchurl"
113 115 adding url.diff to series file
114 116 $ rm url.diff
115 117 $ hg qun
116 118 url.diff
117 119
118 120 import patch that already exists
119 121
120 122 $ echo foo2 >> foo
121 123 $ hg add foo
122 124 $ hg diff > ../url.diff
123 125 $ hg revert --no-backup foo
124 126 $ rm foo
125 127 $ hg qimport ../url.diff
126 128 abort: patch "url.diff" already exists
127 129 [255]
128 130 $ hg qpush
129 131 applying url.diff
130 132 now at: url.diff
131 133 $ cat foo
132 134 foo
133 135 $ hg qpop
134 136 popping url.diff
135 137 patch queue now empty
136 138
137 139 qimport -f
138 140
139 141 $ hg qimport -f ../url.diff
140 142 adding url.diff to series file
141 143 $ hg qpush
142 144 applying url.diff
143 145 now at: url.diff
144 146 $ cat foo
145 147 foo2
146 148 $ hg qpop
147 149 popping url.diff
148 150 patch queue now empty
149 151
150 152 build diff with CRLF
151 153
152 154 $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
153 155 $ hg ci -Am addb
154 156 adding b
155 157 $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
156 158 $ hg diff > b.diff
157 159 $ hg up -C
158 160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159 161
160 162 qimport CRLF diff
161 163
162 164 $ hg qimport b.diff
163 165 adding b.diff to series file
164 166 $ hg qpush
165 167 applying b.diff
166 168 now at: b.diff
167 169
168 170 try to import --push
169 171
170 172 $ cat > appendfoo.diff <<EOF
171 173 > append foo
172 174 >
173 175 > diff -r 07f494440405 -r 261500830e46 baz
174 176 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
175 177 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
176 178 > @@ -0,0 +1,1 @@
177 179 > +foo
178 180 > EOF
179 181
180 182 $ cat > appendbar.diff <<EOF
181 183 > append bar
182 184 >
183 185 > diff -r 07f494440405 -r 261500830e46 baz
184 186 > --- a/baz Thu Jan 01 00:00:00 1970 +0000
185 187 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
186 188 > @@ -1,1 +1,2 @@
187 189 > foo
188 190 > +bar
189 191 > EOF
190 192
191 193 $ hg qimport --push appendfoo.diff appendbar.diff
192 194 adding appendfoo.diff to series file
193 195 adding appendbar.diff to series file
194 196 applying appendfoo.diff
195 197 applying appendbar.diff
196 198 now at: appendbar.diff
197 199 $ hg qfin -a
198 200 patch b.diff finalized without changeset message
199 201 $ touch .hg/patches/2.diff
200 202 $ hg qimport -r 'p1(.)::'
201 203 abort: patch "2.diff" already exists
202 204 [255]
203 205 $ hg qapplied
204 206 3.diff
205 207 $ hg qfin -a
206 208 $ rm .hg/patches/2.diff
207 209 $ hg qimport -r 'p1(.)::' -P
208 210 $ hg qpop -a
209 211 popping 3.diff
210 212 popping 2.diff
211 213 patch queue now empty
212 214 $ hg qdel 3.diff
213 215 $ hg qdel -k 2.diff
214 216
215 217 qimport -e
216 218
217 219 $ hg qimport -e 2.diff
218 220 adding 2.diff to series file
219 221 $ hg qdel -k 2.diff
220 222
221 223 qimport -e --name newname oldexisitingpatch
222 224
223 225 $ hg qimport -e --name this-name-is-better 2.diff
224 226 renaming 2.diff to this-name-is-better
225 227 adding this-name-is-better to series file
226 228 $ hg qser
227 229 this-name-is-better
228 230 url.diff
229 231
230 232 qimport -e --name without --force
231 233
232 234 $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
233 235 $ hg qimport -e --name this-name-is-better 3.diff
234 236 abort: patch "this-name-is-better" already exists
235 237 [255]
236 238 $ hg qser
237 239 this-name-is-better
238 240 url.diff
239 241
240 242 qimport -e --name with --force
241 243
242 244 $ hg qimport --force -e --name this-name-is-better 3.diff
243 245 renaming 3.diff to this-name-is-better
244 246 adding this-name-is-better to series file
245 247 $ hg qser
246 248 this-name-is-better
247 249 url.diff
248 250
249 251 qimport with bad name, should abort before reading file
250 252
251 253 $ hg qimport non-existent-file --name .hg
252 254 abort: patch name cannot begin with ".hg"
253 255 [255]
254 256
255 257 qimport http:// patch with leading slashes in url
256 258
257 259 set up hgweb
258 260
259 261 $ cd ..
260 262 $ hg init served
261 263 $ cd served
262 264 $ echo a > a
263 265 $ hg ci -Am patch
264 266 adding a
265 267 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
266 268 $ cat hg.pid >> $DAEMON_PIDS
267 269
268 270 $ cd ../repo
269 271 $ hg qimport http://localhost:$HGPORT/raw-rev/0///
270 272 adding 0 to series file
271 273
272 274 check qimport phase:
273 275
274 276 $ hg -q qpush
275 277 now at: 0
276 278 $ hg phase qparent
277 279 1: draft
278 280 $ hg qimport -r qparent
279 281 $ hg phase qbase
280 282 1: draft
281 283 $ hg qfinish qbase
282 284 $ echo '[mq]' >> $HGRCPATH
283 285 $ echo 'secret=true' >> $HGRCPATH
284 286 $ hg qimport -r qparent
285 287 $ hg phase qbase
286 288 1: secret
287 289
288 290 $ cd ..
289 291
290 292 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
@@ -1,550 +1,552 b''
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[diff]" >> $HGRCPATH
4 $ echo "nodates=1" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > mq =
4 > [diff]
5 > nodates = 1
6 > EOF
5 7
6 8 $ hg init a
7 9 $ cd a
8 10
9 11 $ mkdir 1 2
10 12 $ echo 'base' > 1/base
11 13 $ echo 'base' > 2/base
12 14 $ hg ci -Ambase
13 15 adding 1/base
14 16 adding 2/base
15 17
16 18 $ hg qnew -mmqbase mqbase
17 19
18 20 $ echo 'patched' > 1/base
19 21 $ echo 'patched' > 2/base
20 22 $ hg qrefresh
21 23
22 24 $ hg qdiff
23 25 diff -r e7af5904b465 1/base
24 26 --- a/1/base
25 27 +++ b/1/base
26 28 @@ -1,1 +1,1 @@
27 29 -base
28 30 +patched
29 31 diff -r e7af5904b465 2/base
30 32 --- a/2/base
31 33 +++ b/2/base
32 34 @@ -1,1 +1,1 @@
33 35 -base
34 36 +patched
35 37
36 38 $ hg qdiff .
37 39 diff -r e7af5904b465 1/base
38 40 --- a/1/base
39 41 +++ b/1/base
40 42 @@ -1,1 +1,1 @@
41 43 -base
42 44 +patched
43 45 diff -r e7af5904b465 2/base
44 46 --- a/2/base
45 47 +++ b/2/base
46 48 @@ -1,1 +1,1 @@
47 49 -base
48 50 +patched
49 51
50 52 $ cat .hg/patches/mqbase
51 53 # HG changeset patch
52 54 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
53 55 mqbase
54 56
55 57 diff -r e7af5904b465 1/base
56 58 --- a/1/base
57 59 +++ b/1/base
58 60 @@ -1,1 +1,1 @@
59 61 -base
60 62 +patched
61 63 diff -r e7af5904b465 2/base
62 64 --- a/2/base
63 65 +++ b/2/base
64 66 @@ -1,1 +1,1 @@
65 67 -base
66 68 +patched
67 69
68 70 $ echo 'patched again' > base
69 71 $ hg qrefresh 1
70 72
71 73 $ hg qdiff
72 74 diff -r e7af5904b465 1/base
73 75 --- a/1/base
74 76 +++ b/1/base
75 77 @@ -1,1 +1,1 @@
76 78 -base
77 79 +patched
78 80 diff -r e7af5904b465 2/base
79 81 --- a/2/base
80 82 +++ b/2/base
81 83 @@ -1,1 +1,1 @@
82 84 -base
83 85 +patched
84 86
85 87 $ hg qdiff .
86 88 diff -r e7af5904b465 1/base
87 89 --- a/1/base
88 90 +++ b/1/base
89 91 @@ -1,1 +1,1 @@
90 92 -base
91 93 +patched
92 94 diff -r e7af5904b465 2/base
93 95 --- a/2/base
94 96 +++ b/2/base
95 97 @@ -1,1 +1,1 @@
96 98 -base
97 99 +patched
98 100
99 101 $ cat .hg/patches/mqbase
100 102 # HG changeset patch
101 103 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
102 104 mqbase
103 105
104 106 diff -r e7af5904b465 1/base
105 107 --- a/1/base
106 108 +++ b/1/base
107 109 @@ -1,1 +1,1 @@
108 110 -base
109 111 +patched
110 112
111 113 qrefresh . in subdir:
112 114
113 115 $ ( cd 1 ; hg qrefresh . )
114 116
115 117 $ hg qdiff
116 118 diff -r e7af5904b465 1/base
117 119 --- a/1/base
118 120 +++ b/1/base
119 121 @@ -1,1 +1,1 @@
120 122 -base
121 123 +patched
122 124 diff -r e7af5904b465 2/base
123 125 --- a/2/base
124 126 +++ b/2/base
125 127 @@ -1,1 +1,1 @@
126 128 -base
127 129 +patched
128 130
129 131 $ hg qdiff .
130 132 diff -r e7af5904b465 1/base
131 133 --- a/1/base
132 134 +++ b/1/base
133 135 @@ -1,1 +1,1 @@
134 136 -base
135 137 +patched
136 138 diff -r e7af5904b465 2/base
137 139 --- a/2/base
138 140 +++ b/2/base
139 141 @@ -1,1 +1,1 @@
140 142 -base
141 143 +patched
142 144
143 145 $ cat .hg/patches/mqbase
144 146 # HG changeset patch
145 147 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
146 148 mqbase
147 149
148 150 diff -r e7af5904b465 1/base
149 151 --- a/1/base
150 152 +++ b/1/base
151 153 @@ -1,1 +1,1 @@
152 154 -base
153 155 +patched
154 156
155 157 qrefresh in hg-root again:
156 158
157 159 $ hg qrefresh
158 160
159 161 $ hg qdiff
160 162 diff -r e7af5904b465 1/base
161 163 --- a/1/base
162 164 +++ b/1/base
163 165 @@ -1,1 +1,1 @@
164 166 -base
165 167 +patched
166 168 diff -r e7af5904b465 2/base
167 169 --- a/2/base
168 170 +++ b/2/base
169 171 @@ -1,1 +1,1 @@
170 172 -base
171 173 +patched
172 174
173 175 $ hg qdiff .
174 176 diff -r e7af5904b465 1/base
175 177 --- a/1/base
176 178 +++ b/1/base
177 179 @@ -1,1 +1,1 @@
178 180 -base
179 181 +patched
180 182 diff -r e7af5904b465 2/base
181 183 --- a/2/base
182 184 +++ b/2/base
183 185 @@ -1,1 +1,1 @@
184 186 -base
185 187 +patched
186 188
187 189 $ cat .hg/patches/mqbase
188 190 # HG changeset patch
189 191 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
190 192 mqbase
191 193
192 194 diff -r e7af5904b465 1/base
193 195 --- a/1/base
194 196 +++ b/1/base
195 197 @@ -1,1 +1,1 @@
196 198 -base
197 199 +patched
198 200 diff -r e7af5904b465 2/base
199 201 --- a/2/base
200 202 +++ b/2/base
201 203 @@ -1,1 +1,1 @@
202 204 -base
203 205 +patched
204 206
205 207
206 208 qrefresh --short tests:
207 209
208 210 $ echo 'orphan' > orphanchild
209 211 $ hg add orphanchild
210 212 $ hg qrefresh nonexistentfilename # clear patch
211 213 nonexistentfilename: * (glob)
212 214 $ hg diff -c qtip
213 215 $ hg qrefresh --short 1/base
214 216 $ hg qrefresh --short 2/base
215 217
216 218 $ hg qdiff
217 219 diff -r e7af5904b465 1/base
218 220 --- a/1/base
219 221 +++ b/1/base
220 222 @@ -1,1 +1,1 @@
221 223 -base
222 224 +patched
223 225 diff -r e7af5904b465 2/base
224 226 --- a/2/base
225 227 +++ b/2/base
226 228 @@ -1,1 +1,1 @@
227 229 -base
228 230 +patched
229 231 diff -r e7af5904b465 orphanchild
230 232 --- /dev/null
231 233 +++ b/orphanchild
232 234 @@ -0,0 +1,1 @@
233 235 +orphan
234 236
235 237 $ cat .hg/patches/mqbase
236 238 # HG changeset patch
237 239 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
238 240 mqbase
239 241
240 242 diff -r e7af5904b465 1/base
241 243 --- a/1/base
242 244 +++ b/1/base
243 245 @@ -1,1 +1,1 @@
244 246 -base
245 247 +patched
246 248 diff -r e7af5904b465 2/base
247 249 --- a/2/base
248 250 +++ b/2/base
249 251 @@ -1,1 +1,1 @@
250 252 -base
251 253 +patched
252 254
253 255 $ hg st
254 256 A orphanchild
255 257 ? base
256 258
257 259 diff shows what is not in patch:
258 260
259 261 $ hg diff
260 262 diff -r ???????????? orphanchild (glob)
261 263 --- /dev/null
262 264 +++ b/orphanchild
263 265 @@ -0,0 +1,1 @@
264 266 +orphan
265 267
266 268 Before starting exclusive tests:
267 269
268 270 $ cat .hg/patches/mqbase
269 271 # HG changeset patch
270 272 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
271 273 mqbase
272 274
273 275 diff -r e7af5904b465 1/base
274 276 --- a/1/base
275 277 +++ b/1/base
276 278 @@ -1,1 +1,1 @@
277 279 -base
278 280 +patched
279 281 diff -r e7af5904b465 2/base
280 282 --- a/2/base
281 283 +++ b/2/base
282 284 @@ -1,1 +1,1 @@
283 285 -base
284 286 +patched
285 287
286 288 Exclude 2/base:
287 289
288 290 $ hg qref -s -X 2/base
289 291
290 292 $ cat .hg/patches/mqbase
291 293 # HG changeset patch
292 294 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
293 295 mqbase
294 296
295 297 diff -r e7af5904b465 1/base
296 298 --- a/1/base
297 299 +++ b/1/base
298 300 @@ -1,1 +1,1 @@
299 301 -base
300 302 +patched
301 303
302 304 status shows 2/base as dirty:
303 305
304 306 $ hg status
305 307 M 2/base
306 308 A orphanchild
307 309 ? base
308 310
309 311 Remove 1/base and add 2/base again but not orphanchild:
310 312
311 313 $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
312 314
313 315 $ cat .hg/patches/mqbase
314 316 # HG changeset patch
315 317 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
316 318 mqbase
317 319
318 320 diff -r e7af5904b465 2/base
319 321 --- a/2/base
320 322 +++ b/2/base
321 323 @@ -1,1 +1,1 @@
322 324 -base
323 325 +patched
324 326
325 327 Add 1/base with include filter - and thus remove 2/base from patch:
326 328
327 329 $ hg qref -s -I 1/ o* */*
328 330
329 331 $ cat .hg/patches/mqbase
330 332 # HG changeset patch
331 333 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
332 334 mqbase
333 335
334 336 diff -r e7af5904b465 1/base
335 337 --- a/1/base
336 338 +++ b/1/base
337 339 @@ -1,1 +1,1 @@
338 340 -base
339 341 +patched
340 342
341 343 $ cd ..
342 344
343 345
344 346 Test qrefresh --git losing copy metadata:
345 347
346 348 $ hg init repo
347 349 $ cd repo
348 350
349 351 $ echo "[diff]" >> .hg/hgrc
350 352 $ echo "git=True" >> .hg/hgrc
351 353 $ echo a > a
352 354
353 355 $ hg ci -Am adda
354 356 adding a
355 357 $ hg copy a ab
356 358 $ echo b >> ab
357 359 $ hg copy a ac
358 360 $ echo c >> ac
359 361
360 362 Capture changes:
361 363
362 364 $ hg qnew -f p1
363 365
364 366 $ hg qdiff
365 367 diff --git a/a b/ab
366 368 copy from a
367 369 copy to ab
368 370 --- a/a
369 371 +++ b/ab
370 372 @@ -1,1 +1,2 @@
371 373 a
372 374 +b
373 375 diff --git a/a b/ac
374 376 copy from a
375 377 copy to ac
376 378 --- a/a
377 379 +++ b/ac
378 380 @@ -1,1 +1,2 @@
379 381 a
380 382 +c
381 383
382 384 Refresh and check changes again:
383 385
384 386 $ hg qrefresh
385 387
386 388 $ hg qdiff
387 389 diff --git a/a b/ab
388 390 copy from a
389 391 copy to ab
390 392 --- a/a
391 393 +++ b/ab
392 394 @@ -1,1 +1,2 @@
393 395 a
394 396 +b
395 397 diff --git a/a b/ac
396 398 copy from a
397 399 copy to ac
398 400 --- a/a
399 401 +++ b/ac
400 402 @@ -1,1 +1,2 @@
401 403 a
402 404 +c
403 405
404 406 $ cd ..
405 407
406 408
407 409 Issue1441: qrefresh confused after hg rename:
408 410
409 411 $ hg init repo-1441
410 412 $ cd repo-1441
411 413 $ echo a > a
412 414 $ hg add a
413 415 $ hg qnew -f p
414 416 $ hg mv a b
415 417 $ hg qrefresh
416 418
417 419 $ hg qdiff
418 420 diff -r 000000000000 b
419 421 --- /dev/null
420 422 +++ b/b
421 423 @@ -0,0 +1,1 @@
422 424 +a
423 425
424 426 $ cd ..
425 427
426 428
427 429 Issue2025: qrefresh does not honor filtering options when tip !=
428 430 qtip:
429 431
430 432 $ hg init repo-2025
431 433 $ cd repo-2025
432 434 $ echo a > a
433 435 $ echo b > b
434 436 $ hg ci -qAm addab
435 437 $ echo a >> a
436 438 $ echo b >> b
437 439 $ hg qnew -f patch
438 440 $ hg up -qC 0
439 441 $ echo c > c
440 442 $ hg ci -qAm addc
441 443 $ hg up -qC 1
442 444
443 445 refresh with tip != qtip:
444 446
445 447 $ hg --config diff.nodates=1 qrefresh -I b
446 448
447 449 $ hg st
448 450 M a
449 451
450 452 $ cat b
451 453 b
452 454 b
453 455
454 456 $ cat .hg/patches/patch
455 457 # HG changeset patch
456 458 # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
457 459
458 460 diff -r 1a60229be7ac b
459 461 --- a/b
460 462 +++ b/b
461 463 @@ -1,1 +1,2 @@
462 464 b
463 465 +b
464 466
465 467 $ cd ..
466 468
467 469
468 470 Issue1441 with git patches:
469 471
470 472 $ hg init repo-1441-git
471 473 $ cd repo-1441-git
472 474
473 475 $ echo "[diff]" >> .hg/hgrc
474 476 $ echo "git=True" >> .hg/hgrc
475 477
476 478 $ echo a > a
477 479 $ hg add a
478 480 $ hg qnew -f p
479 481 $ hg mv a b
480 482 $ hg qrefresh
481 483
482 484 $ hg qdiff --nodates
483 485 diff --git a/b b/b
484 486 new file mode 100644
485 487 --- /dev/null
486 488 +++ b/b
487 489 @@ -0,0 +1,1 @@
488 490 +a
489 491
490 492 $ cd ..
491 493
492 494 Refresh with bad usernames. Mercurial used to abort on bad usernames,
493 495 but only after writing the bad name into the patch.
494 496
495 497 $ hg init bad-usernames
496 498 $ cd bad-usernames
497 499 $ touch a
498 500 $ hg add a
499 501 $ hg qnew a
500 502 $ hg qrefresh -u 'foo
501 503 > bar'
502 504 transaction abort!
503 505 rollback completed
504 506 refresh interrupted while patch was popped! (revert --all, qpush to recover)
505 507 abort: username 'foo\nbar' contains a newline!
506 508 [255]
507 509 $ rm a
508 510 $ cat .hg/patches/a
509 511 # HG changeset patch
510 512 # Parent 0000000000000000000000000000000000000000
511 513
512 514 diff --git a/a b/a
513 515 new file mode 100644
514 516 $ hg qpush
515 517 applying a
516 518 now at: a
517 519 $ hg qrefresh -u ' '
518 520 transaction abort!
519 521 rollback completed
520 522 refresh interrupted while patch was popped! (revert --all, qpush to recover)
521 523 abort: empty username!
522 524 [255]
523 525 $ cat .hg/patches/a
524 526 # HG changeset patch
525 527 # Parent 0000000000000000000000000000000000000000
526 528
527 529 diff --git a/a b/a
528 530 new file mode 100644
529 531 $ cd ..
530 532
531 533 Refresh with phase data:
532 534
533 535
534 536
535 537 $ cd repo
536 538 $ echo 'babar' >> a
537 539 $ hg qnew -m 'update a' p2.diff
538 540 $ hg phase p2.diff
539 541 2: draft
540 542 $ echo 'beber' >> a
541 543 $ hg qref
542 544 $ hg phase p2.diff
543 545 2: draft
544 546 $ hg phase --force --secret p2.diff
545 547 $ echo 'bibir' >> a
546 548 $ hg qref
547 549 $ hg phase p2.diff
548 550 2: secret
549 551
550 552 $ cd ..
@@ -1,54 +1,56 b''
1 1 #require svn13
2 2
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ echo "[diff]" >> $HGRCPATH
6 $ echo "nodates=1" >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
5 > mq =
6 > [diff]
7 > nodates = 1
8 > EOF
7 9
8 10 fn to create new repository, and cd into it
9 11 $ mkrepo() {
10 12 > hg init $1
11 13 > cd $1
12 14 > hg qinit
13 15 > }
14 16
15 17
16 18 handle svn subrepos safely
17 19
18 20 $ svnadmin create svn-repo-2499
19 21
20 22 $ SVNREPOPATH=`pwd`/svn-repo-2499/project
21 23 #if windows
22 24 $ SVNREPOURL=file:///`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
23 25 #else
24 26 $ SVNREPOURL=file://`$PYTHON -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
25 27 #endif
26 28
27 29 $ mkdir -p svn-project-2499/trunk
28 30 $ svn import -m 'init project' svn-project-2499 "$SVNREPOURL"
29 31 Adding svn-project-2499/trunk (glob)
30 32
31 33 Committed revision 1.
32 34
33 35 qnew on repo w/svn subrepo
34 36 $ mkrepo repo-2499-svn-subrepo
35 37 $ svn co "$SVNREPOURL"/trunk sub
36 38 Checked out revision 1.
37 39 $ echo 'sub = [svn]sub' >> .hgsub
38 40 $ hg add .hgsub
39 41 $ hg status -S -X '**/format'
40 42 A .hgsub
41 43 $ hg qnew -m0 0.diff
42 44 $ cd sub
43 45 $ echo a > a
44 46 $ svn add a
45 47 A a
46 48 $ svn st
47 49 A* a (glob)
48 50 $ cd ..
49 51 $ hg status -S # doesn't show status for svn subrepos (yet)
50 52 $ hg qnew -m1 1.diff
51 53 abort: uncommitted changes in subrepository sub
52 54 [255]
53 55
54 56 $ cd ..
@@ -1,609 +1,611 b''
1 $ echo "[ui]" >> $HGRCPATH
2 $ echo "commitsubrepos = Yes" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5 $ echo "record=" >> $HGRCPATH
6 $ echo "[diff]" >> $HGRCPATH
7 $ echo "nodates=1" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [ui]
3 > commitsubrepos = Yes
4 > [extensions]
5 > mq =
6 > record =
7 > [diff]
8 > nodates = 1
9 > EOF
8 10
9 11 $ stdin=`pwd`/stdin.tmp
10 12
11 13 fn to create new repository w/dirty subrepo, and cd into it
12 14 $ mkrepo() {
13 15 > hg init $1
14 16 > cd $1
15 17 > hg qinit
16 18 > }
17 19
18 20 fn to create dirty subrepo
19 21 $ mksubrepo() {
20 22 > hg init $1
21 23 > cd $1
22 24 > echo a > a
23 25 > hg add
24 26 > cd ..
25 27 > }
26 28
27 29 $ testadd() {
28 30 > cat - > "$stdin"
29 31 > mksubrepo sub
30 32 > echo sub = sub >> .hgsub
31 33 > hg add .hgsub
32 34 > echo % abort when adding .hgsub w/dirty subrepo
33 35 > hg status -S
34 36 > echo '%' $*
35 37 > cat "$stdin" | hg $*
36 38 > echo [$?]
37 39 > hg -R sub ci -m0sub
38 40 > echo % update substate when adding .hgsub w/clean updated subrepo
39 41 > hg status -S
40 42 > echo '%' $*
41 43 > cat "$stdin" | hg $*
42 44 > hg debugsub
43 45 > }
44 46
45 47 $ testmod() {
46 48 > cat - > "$stdin"
47 49 > mksubrepo sub2
48 50 > echo sub2 = sub2 >> .hgsub
49 51 > echo % abort when modifying .hgsub w/dirty subrepo
50 52 > hg status -S
51 53 > echo '%' $*
52 54 > cat "$stdin" | hg $*
53 55 > echo [$?]
54 56 > hg -R sub2 ci -m0sub2
55 57 > echo % update substate when modifying .hgsub w/clean updated subrepo
56 58 > hg status -S
57 59 > echo '%' $*
58 60 > cat "$stdin" | hg $*
59 61 > hg debugsub
60 62 > }
61 63
62 64 $ testrm1() {
63 65 > cat - > "$stdin"
64 66 > mksubrepo sub3
65 67 > echo sub3 = sub3 >> .hgsub
66 68 > hg ci -Aqmsub3
67 69 > $EXTRA
68 70 > echo b >> sub3/a
69 71 > hg rm .hgsub
70 72 > echo % update substate when removing .hgsub w/dirty subrepo
71 73 > hg status -S
72 74 > echo '%' $*
73 75 > cat "$stdin" | hg $*
74 76 > echo % debugsub should be empty
75 77 > hg debugsub
76 78 > }
77 79
78 80 $ testrm2() {
79 81 > cat - > "$stdin"
80 82 > mksubrepo sub4
81 83 > echo sub4 = sub4 >> .hgsub
82 84 > hg ci -Aqmsub4
83 85 > $EXTRA
84 86 > hg rm .hgsub
85 87 > echo % update substate when removing .hgsub w/clean updated subrepo
86 88 > hg status -S
87 89 > echo '%' $*
88 90 > cat "$stdin" | hg $*
89 91 > echo % debugsub should be empty
90 92 > hg debugsub
91 93 > }
92 94
93 95
94 96 handle subrepos safely on qnew
95 97
96 98 $ mkrepo repo-2499-qnew
97 99 $ testadd qnew -X path:no-effect -m0 0.diff
98 100 adding a
99 101 % abort when adding .hgsub w/dirty subrepo
100 102 A .hgsub
101 103 A sub/a
102 104 % qnew -X path:no-effect -m0 0.diff
103 105 abort: uncommitted changes in subrepository sub
104 106 [255]
105 107 % update substate when adding .hgsub w/clean updated subrepo
106 108 A .hgsub
107 109 % qnew -X path:no-effect -m0 0.diff
108 110 path sub
109 111 source sub
110 112 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
111 113
112 114 $ testmod qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff
113 115 adding a
114 116 % abort when modifying .hgsub w/dirty subrepo
115 117 M .hgsub
116 118 A sub2/a
117 119 % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff
118 120 abort: uncommitted changes in subrepository sub2
119 121 [255]
120 122 % update substate when modifying .hgsub w/clean updated subrepo
121 123 M .hgsub
122 124 % qnew --cwd .. -R repo-2499-qnew -X path:no-effect -m1 1.diff
123 125 path sub
124 126 source sub
125 127 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
126 128 path sub2
127 129 source sub2
128 130 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
129 131
130 132 $ hg qpop -qa
131 133 patch queue now empty
132 134 $ testrm1 qnew -m2 2.diff
133 135 adding a
134 136 % update substate when removing .hgsub w/dirty subrepo
135 137 M sub3/a
136 138 R .hgsub
137 139 % qnew -m2 2.diff
138 140 % debugsub should be empty
139 141
140 142 $ hg qpop -qa
141 143 patch queue now empty
142 144 $ testrm2 qnew -m3 3.diff
143 145 adding a
144 146 % update substate when removing .hgsub w/clean updated subrepo
145 147 R .hgsub
146 148 % qnew -m3 3.diff
147 149 % debugsub should be empty
148 150
149 151 $ cd ..
150 152
151 153
152 154 handle subrepos safely on qrefresh
153 155
154 156 $ mkrepo repo-2499-qrefresh
155 157 $ hg qnew -m0 0.diff
156 158 $ testadd qrefresh
157 159 adding a
158 160 % abort when adding .hgsub w/dirty subrepo
159 161 A .hgsub
160 162 A sub/a
161 163 % qrefresh
162 164 abort: uncommitted changes in subrepository sub
163 165 [255]
164 166 % update substate when adding .hgsub w/clean updated subrepo
165 167 A .hgsub
166 168 % qrefresh
167 169 path sub
168 170 source sub
169 171 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
170 172
171 173 $ hg qnew -m1 1.diff
172 174 $ testmod qrefresh
173 175 adding a
174 176 % abort when modifying .hgsub w/dirty subrepo
175 177 M .hgsub
176 178 A sub2/a
177 179 % qrefresh
178 180 abort: uncommitted changes in subrepository sub2
179 181 [255]
180 182 % update substate when modifying .hgsub w/clean updated subrepo
181 183 M .hgsub
182 184 % qrefresh
183 185 path sub
184 186 source sub
185 187 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
186 188 path sub2
187 189 source sub2
188 190 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
189 191
190 192 $ hg qpop -qa
191 193 patch queue now empty
192 194 $ EXTRA='hg qnew -m2 2.diff'
193 195 $ testrm1 qrefresh
194 196 adding a
195 197 % update substate when removing .hgsub w/dirty subrepo
196 198 M sub3/a
197 199 R .hgsub
198 200 % qrefresh
199 201 % debugsub should be empty
200 202
201 203 $ hg qpop -qa
202 204 patch queue now empty
203 205 $ EXTRA='hg qnew -m3 3.diff'
204 206 $ testrm2 qrefresh
205 207 adding a
206 208 % update substate when removing .hgsub w/clean updated subrepo
207 209 R .hgsub
208 210 % qrefresh
209 211 % debugsub should be empty
210 212 $ EXTRA=
211 213
212 214 $ cd ..
213 215
214 216
215 217 handle subrepos safely on qpush/qpop
216 218 (and we cannot qpop / qpush with a modified subrepo)
217 219
218 220 $ mkrepo repo-2499-qpush
219 221 $ mksubrepo sub
220 222 adding a
221 223 $ hg -R sub ci -m0sub
222 224 $ echo sub = sub > .hgsub
223 225 $ hg add .hgsub
224 226 $ hg commit -m0
225 227 $ hg debugsub
226 228 path sub
227 229 source sub
228 230 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
229 231 $ echo foo > ./sub/a
230 232 $ hg -R sub commit -m foo
231 233 $ hg commit -m1
232 234 $ hg qimport -r "0:tip"
233 235 $ hg -R sub id --id
234 236 aa037b301eba
235 237
236 238 qpop
237 239 $ hg -R sub update 0000
238 240 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
239 241 $ hg qpop
240 242 abort: local changed subrepos found, refresh first
241 243 [255]
242 244 $ hg revert sub
243 245 reverting subrepo sub
244 246 adding sub/a
245 247 $ hg qpop
246 248 popping 1.diff
247 249 now at: 0.diff
248 250 $ hg status -AS
249 251 C .hgsub
250 252 C .hgsubstate
251 253 C sub/a
252 254 $ hg -R sub id --id
253 255 b2fdb12cd82b
254 256
255 257 qpush
256 258 $ hg -R sub update 0000
257 259 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
258 260 $ hg qpush
259 261 abort: local changed subrepos found, refresh first
260 262 [255]
261 263 $ hg revert sub
262 264 reverting subrepo sub
263 265 adding sub/a
264 266 $ hg qpush
265 267 applying 1.diff
266 268 subrepository sub diverged (local revision: b2fdb12cd82b, remote revision: aa037b301eba)
267 269 (M)erge, keep (l)ocal or keep (r)emote? m
268 270 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
269 271 now at: 1.diff
270 272 $ hg status -AS
271 273 C .hgsub
272 274 C .hgsubstate
273 275 C sub/a
274 276 $ hg -R sub id --id
275 277 aa037b301eba
276 278
277 279 $ cd ..
278 280
279 281
280 282 handle subrepos safely on qrecord
281 283
282 284 $ mkrepo repo-2499-qrecord
283 285 $ testadd qrecord --config ui.interactive=1 -m0 0.diff <<EOF
284 286 > y
285 287 > y
286 288 > EOF
287 289 adding a
288 290 % abort when adding .hgsub w/dirty subrepo
289 291 A .hgsub
290 292 A sub/a
291 293 % qrecord --config ui.interactive=1 -m0 0.diff
292 294 diff --git a/.hgsub b/.hgsub
293 295 new file mode 100644
294 296 examine changes to '.hgsub'? [Ynesfdaq?] y
295 297
296 298 abort: uncommitted changes in subrepository sub
297 299 [255]
298 300 % update substate when adding .hgsub w/clean updated subrepo
299 301 A .hgsub
300 302 % qrecord --config ui.interactive=1 -m0 0.diff
301 303 diff --git a/.hgsub b/.hgsub
302 304 new file mode 100644
303 305 examine changes to '.hgsub'? [Ynesfdaq?] y
304 306
305 307 path sub
306 308 source sub
307 309 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
308 310
309 311 $ testmod qrecord --config ui.interactive=1 -m1 1.diff <<EOF
310 312 > y
311 313 > y
312 314 > EOF
313 315 adding a
314 316 % abort when modifying .hgsub w/dirty subrepo
315 317 M .hgsub
316 318 A sub2/a
317 319 % qrecord --config ui.interactive=1 -m1 1.diff
318 320 diff --git a/.hgsub b/.hgsub
319 321 1 hunks, 1 lines changed
320 322 examine changes to '.hgsub'? [Ynesfdaq?] y
321 323
322 324 @@ -1,1 +1,2 @@
323 325 sub = sub
324 326 +sub2 = sub2
325 327 record this change to '.hgsub'? [Ynesfdaq?] y
326 328
327 329 abort: uncommitted changes in subrepository sub2
328 330 [255]
329 331 % update substate when modifying .hgsub w/clean updated subrepo
330 332 M .hgsub
331 333 % qrecord --config ui.interactive=1 -m1 1.diff
332 334 diff --git a/.hgsub b/.hgsub
333 335 1 hunks, 1 lines changed
334 336 examine changes to '.hgsub'? [Ynesfdaq?] y
335 337
336 338 @@ -1,1 +1,2 @@
337 339 sub = sub
338 340 +sub2 = sub2
339 341 record this change to '.hgsub'? [Ynesfdaq?] y
340 342
341 343 path sub
342 344 source sub
343 345 revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
344 346 path sub2
345 347 source sub2
346 348 revision 1f94c7611cc6b74f5a17b16121a1170d44776845
347 349
348 350 $ hg qpop -qa
349 351 patch queue now empty
350 352 $ testrm1 qrecord --config ui.interactive=1 -m2 2.diff <<EOF
351 353 > y
352 354 > y
353 355 > EOF
354 356 adding a
355 357 % update substate when removing .hgsub w/dirty subrepo
356 358 M sub3/a
357 359 R .hgsub
358 360 % qrecord --config ui.interactive=1 -m2 2.diff
359 361 diff --git a/.hgsub b/.hgsub
360 362 deleted file mode 100644
361 363 examine changes to '.hgsub'? [Ynesfdaq?] y
362 364
363 365 % debugsub should be empty
364 366
365 367 $ hg qpop -qa
366 368 patch queue now empty
367 369 $ testrm2 qrecord --config ui.interactive=1 -m3 3.diff <<EOF
368 370 > y
369 371 > y
370 372 > EOF
371 373 adding a
372 374 % update substate when removing .hgsub w/clean updated subrepo
373 375 R .hgsub
374 376 % qrecord --config ui.interactive=1 -m3 3.diff
375 377 diff --git a/.hgsub b/.hgsub
376 378 deleted file mode 100644
377 379 examine changes to '.hgsub'? [Ynesfdaq?] y
378 380
379 381 % debugsub should be empty
380 382
381 383 $ cd ..
382 384
383 385
384 386 correctly handle subrepos with patch queues
385 387 $ mkrepo repo-subrepo-with-queue
386 388 $ mksubrepo sub
387 389 adding a
388 390 $ hg -R sub qnew sub0.diff
389 391 $ echo sub = sub >> .hgsub
390 392 $ hg add .hgsub
391 393 $ hg qnew 0.diff
392 394
393 395 $ cd ..
394 396
395 397 check whether MQ operations can import updated .hgsubstate correctly
396 398 both into 'revision' and 'patch file under .hg/patches':
397 399
398 400 $ hg init importing-hgsubstate
399 401 $ cd importing-hgsubstate
400 402
401 403 $ echo a > a
402 404 $ hg commit -u test -d '0 0' -Am '#0 in parent'
403 405 adding a
404 406 $ hg init sub
405 407 $ echo sa > sub/sa
406 408 $ hg -R sub commit -u test -d '0 0' -Am '#0 in sub'
407 409 adding sa
408 410 $ echo 'sub = sub' > .hgsub
409 411 $ touch .hgsubstate
410 412 $ hg add .hgsub .hgsubstate
411 413
412 414 $ hg qnew -u test -d '0 0' import-at-qnew
413 415 $ hg -R sub parents --template '{node} sub\n'
414 416 b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
415 417 $ cat .hgsubstate
416 418 b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
417 419 $ hg diff -c tip
418 420 diff -r f499373e340c -r f69e96d86e75 .hgsub
419 421 --- /dev/null
420 422 +++ b/.hgsub
421 423 @@ -0,0 +1,1 @@
422 424 +sub = sub
423 425 diff -r f499373e340c -r f69e96d86e75 .hgsubstate
424 426 --- /dev/null
425 427 +++ b/.hgsubstate
426 428 @@ -0,0 +1,1 @@
427 429 +b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
428 430 $ cat .hg/patches/import-at-qnew
429 431 # HG changeset patch
430 432 # User test
431 433 # Date 0 0
432 434 # Parent f499373e340cdca5d01dee904aeb42dd2a325e71
433 435
434 436 diff -r f499373e340c -r f69e96d86e75 .hgsub
435 437 --- /dev/null
436 438 +++ b/.hgsub
437 439 @@ -0,0 +1,1 @@
438 440 +sub = sub
439 441 diff -r f499373e340c -r f69e96d86e75 .hgsubstate
440 442 --- /dev/null
441 443 +++ b/.hgsubstate
442 444 @@ -0,0 +1,1 @@
443 445 +b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
444 446 $ hg parents --template '{node}\n'
445 447 f69e96d86e75a6d4fd88285dc9697acb23951041
446 448 $ hg parents --template '{files}\n'
447 449 .hgsub .hgsubstate
448 450
449 451 check also whether qnew not including ".hgsubstate" explicitly causes
450 452 as same result (in node hash) as one including it.
451 453
452 454 $ hg qpop -a -q
453 455 patch queue now empty
454 456 $ hg qdelete import-at-qnew
455 457 $ echo 'sub = sub' > .hgsub
456 458 $ hg add .hgsub
457 459 $ rm -f .hgsubstate
458 460 $ hg qnew -u test -d '0 0' import-at-qnew
459 461 $ hg parents --template '{node}\n'
460 462 f69e96d86e75a6d4fd88285dc9697acb23951041
461 463 $ hg parents --template '{files}\n'
462 464 .hgsub .hgsubstate
463 465
464 466 check whether qrefresh imports updated .hgsubstate correctly
465 467
466 468 $ hg qpop
467 469 popping import-at-qnew
468 470 patch queue now empty
469 471 $ hg qpush
470 472 applying import-at-qnew
471 473 now at: import-at-qnew
472 474 $ hg parents --template '{files}\n'
473 475 .hgsub .hgsubstate
474 476
475 477 $ hg qnew import-at-qrefresh
476 478 $ echo sb > sub/sb
477 479 $ hg -R sub commit -u test -d '0 0' -Am '#1 in sub'
478 480 adding sb
479 481 $ hg qrefresh -u test -d '0 0'
480 482 $ hg -R sub parents --template '{node} sub\n'
481 483 88ac1bef5ed43b689d1d200b59886b675dec474b sub
482 484 $ cat .hgsubstate
483 485 88ac1bef5ed43b689d1d200b59886b675dec474b sub
484 486 $ hg diff -c tip
485 487 diff -r 05b056bb9c8c -r d987bec230f4 .hgsubstate
486 488 --- a/.hgsubstate
487 489 +++ b/.hgsubstate
488 490 @@ -1,1 +1,1 @@
489 491 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
490 492 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
491 493 $ cat .hg/patches/import-at-qrefresh
492 494 # HG changeset patch
493 495 # User test
494 496 # Date 0 0
495 497 # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
496 498
497 499 diff -r 05b056bb9c8c .hgsubstate
498 500 --- a/.hgsubstate
499 501 +++ b/.hgsubstate
500 502 @@ -1,1 +1,1 @@
501 503 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
502 504 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
503 505 $ hg parents --template '{files}\n'
504 506 .hgsubstate
505 507
506 508 $ hg qrefresh -u test -d '0 0'
507 509 $ cat .hgsubstate
508 510 88ac1bef5ed43b689d1d200b59886b675dec474b sub
509 511 $ hg diff -c tip
510 512 diff -r 05b056bb9c8c -r d987bec230f4 .hgsubstate
511 513 --- a/.hgsubstate
512 514 +++ b/.hgsubstate
513 515 @@ -1,1 +1,1 @@
514 516 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
515 517 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
516 518 $ cat .hg/patches/import-at-qrefresh
517 519 # HG changeset patch
518 520 # User test
519 521 # Date 0 0
520 522 # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
521 523
522 524 diff -r 05b056bb9c8c .hgsubstate
523 525 --- a/.hgsubstate
524 526 +++ b/.hgsubstate
525 527 @@ -1,1 +1,1 @@
526 528 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
527 529 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
528 530 $ hg parents --template '{files}\n'
529 531 .hgsubstate
530 532
531 533 $ hg update -C tip
532 534 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
533 535 $ hg qpop -a
534 536 popping import-at-qrefresh
535 537 popping import-at-qnew
536 538 patch queue now empty
537 539
538 540 $ hg -R sub update -C 0
539 541 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
540 542 $ echo 'sub = sub' > .hgsub
541 543 $ hg commit -Am '#1 in parent'
542 544 adding .hgsub
543 545 $ hg -R sub update -C 1
544 546 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
545 547 $ hg commit -Am '#2 in parent (but will be rolled back soon)'
546 548 $ hg rollback
547 549 repository tip rolled back to revision 1 (undo commit)
548 550 working directory now based on revision 1
549 551 $ hg status
550 552 M .hgsubstate
551 553 $ hg qnew -u test -d '0 0' checkstate-at-qnew
552 554 $ hg -R sub parents --template '{node} sub\n'
553 555 88ac1bef5ed43b689d1d200b59886b675dec474b sub
554 556 $ cat .hgsubstate
555 557 88ac1bef5ed43b689d1d200b59886b675dec474b sub
556 558 $ hg diff -c tip
557 559 diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
558 560 --- a/.hgsubstate
559 561 +++ b/.hgsubstate
560 562 @@ -1,1 +1,1 @@
561 563 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
562 564 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
563 565 $ cat .hg/patches/checkstate-at-qnew
564 566 # HG changeset patch
565 567 # User test
566 568 # Date 0 0
567 569 # Parent 4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
568 570
569 571 diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
570 572 --- a/.hgsubstate
571 573 +++ b/.hgsubstate
572 574 @@ -1,1 +1,1 @@
573 575 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
574 576 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
575 577 $ hg parents --template '{files}\n'
576 578 .hgsubstate
577 579
578 580 check whether qrefresh not including ".hgsubstate" explicitly causes
579 581 as same result (in node hash) as one including it.
580 582
581 583 $ hg update -C -q 0
582 584 $ hg qpop -a -q
583 585 patch queue now empty
584 586 $ hg qnew -u test -d '0 0' add-hgsub-at-qrefresh
585 587 $ echo 'sub = sub' > .hgsub
586 588 $ echo > .hgsubstate
587 589 $ hg add .hgsub .hgsubstate
588 590 $ hg qrefresh -u test -d '0 0'
589 591 $ hg parents --template '{node}\n'
590 592 7c48c35501aae6770ed9c2517014628615821a8e
591 593 $ hg parents --template '{files}\n'
592 594 .hgsub .hgsubstate
593 595
594 596 $ hg qpop -a -q
595 597 patch queue now empty
596 598 $ hg qdelete add-hgsub-at-qrefresh
597 599 $ hg qnew -u test -d '0 0' add-hgsub-at-qrefresh
598 600 $ echo 'sub = sub' > .hgsub
599 601 $ hg add .hgsub
600 602 $ rm -f .hgsubstate
601 603 $ hg qrefresh -u test -d '0 0'
602 604 $ hg parents --template '{node}\n'
603 605 7c48c35501aae6770ed9c2517014628615821a8e
604 606 $ hg parents --template '{files}\n'
605 607 .hgsub .hgsubstate
606 608
607 609 $ cd ..
608 610
609 611 $ cd ..
@@ -1,1606 +1,1607 b''
1 1 $ checkundo()
2 2 > {
3 3 > if [ -f .hg/store/undo ]; then
4 4 > echo ".hg/store/undo still exists after $1"
5 5 > fi
6 6 > }
7 7
8 $ echo "[extensions]" >> $HGRCPATH
9 $ echo "mq=" >> $HGRCPATH
10
11 $ echo "[mq]" >> $HGRCPATH
12 $ echo "plain=true" >> $HGRCPATH
8 $ cat <<EOF >> $HGRCPATH
9 > [extensions]
10 > mq =
11 > [mq]
12 > plain = true
13 > EOF
13 14
14 15
15 16 help
16 17
17 18 $ hg help mq
18 19 mq extension - manage a stack of patches
19 20
20 21 This extension lets you work with a stack of patches in a Mercurial
21 22 repository. It manages two stacks of patches - all known patches, and applied
22 23 patches (subset of known patches).
23 24
24 25 Known patches are represented as patch files in the .hg/patches directory.
25 26 Applied patches are both patch files and changesets.
26 27
27 28 Common tasks (use "hg help command" for more details):
28 29
29 30 create new patch qnew
30 31 import existing patch qimport
31 32
32 33 print patch series qseries
33 34 print applied patches qapplied
34 35
35 36 add known patch to applied stack qpush
36 37 remove patch from applied stack qpop
37 38 refresh contents of top applied patch qrefresh
38 39
39 40 By default, mq will automatically use git patches when required to avoid
40 41 losing file mode changes, copy records, binary files or empty files creations
41 42 or deletions. This behaviour can be configured with:
42 43
43 44 [mq]
44 45 git = auto/keep/yes/no
45 46
46 47 If set to 'keep', mq will obey the [diff] section configuration while
47 48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
48 49 will override the [diff] section and always generate git or regular patches,
49 50 possibly losing data in the second case.
50 51
51 52 It may be desirable for mq changesets to be kept in the secret phase (see "hg
52 53 help phases"), which can be enabled with the following setting:
53 54
54 55 [mq]
55 56 secret = True
56 57
57 58 You will by default be managing a patch queue named "patches". You can create
58 59 other, independent patch queues with the "hg qqueue" command.
59 60
60 61 If the working directory contains uncommitted files, qpush, qpop and qgoto
61 62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
62 63
63 64 [mq]
64 65 keepchanges = True
65 66
66 67 make them behave as if --keep-changes were passed, and non-conflicting local
67 68 changes will be tolerated and preserved. If incompatible options such as
68 69 -f/--force or --exact are passed, this setting is ignored.
69 70
70 71 This extension used to provide a strip command. This command now lives in the
71 72 strip extension.
72 73
73 74 list of commands:
74 75
75 76 qapplied print the patches already applied
76 77 qclone clone main and patch repository at same time
77 78 qdelete remove patches from queue
78 79 qdiff diff of the current patch and subsequent modifications
79 80 qfinish move applied patches into repository history
80 81 qfold fold the named patches into the current patch
81 82 qgoto push or pop patches until named patch is at top of stack
82 83 qguard set or print guards for a patch
83 84 qheader print the header of the topmost or specified patch
84 85 qimport import a patch or existing changeset
85 86 qnew create a new patch
86 87 qnext print the name of the next pushable patch
87 88 qpop pop the current patch off the stack
88 89 qprev print the name of the preceding applied patch
89 90 qpush push the next patch onto the stack
90 91 qqueue manage multiple patch queues
91 92 qrefresh update the current patch
92 93 qrename rename a patch
93 94 qselect set or print guarded patches to push
94 95 qseries print the entire series file
95 96 qtop print the name of the current patch
96 97 qunapplied print the patches not yet applied
97 98
98 99 (use "hg help -v mq" to show built-in aliases and global options)
99 100
100 101 $ hg init a
101 102 $ cd a
102 103 $ echo a > a
103 104 $ hg ci -Ama
104 105 adding a
105 106
106 107 $ hg clone . ../k
107 108 updating to branch default
108 109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 110
110 111 $ mkdir b
111 112 $ echo z > b/z
112 113 $ hg ci -Ama
113 114 adding b/z
114 115
115 116
116 117 qinit
117 118
118 119 $ hg qinit
119 120
120 121 $ cd ..
121 122 $ hg init b
122 123
123 124
124 125 -R qinit
125 126
126 127 $ hg -R b qinit
127 128
128 129 $ hg init c
129 130
130 131
131 132 qinit -c
132 133
133 134 $ hg --cwd c qinit -c
134 135 $ hg -R c/.hg/patches st
135 136 A .hgignore
136 137 A series
137 138
138 139
139 140 qinit; qinit -c
140 141
141 142 $ hg init d
142 143 $ cd d
143 144 $ hg qinit
144 145 $ hg qinit -c
145 146
146 147 qinit -c should create both files if they don't exist
147 148
148 149 $ cat .hg/patches/.hgignore
149 150 ^\.hg
150 151 ^\.mq
151 152 syntax: glob
152 153 status
153 154 guards
154 155 $ cat .hg/patches/series
155 156 $ hg qinit -c
156 157 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
157 158 [255]
158 159 $ cd ..
159 160
160 161 $ echo '% qinit; <stuff>; qinit -c'
161 162 % qinit; <stuff>; qinit -c
162 163 $ hg init e
163 164 $ cd e
164 165 $ hg qnew A
165 166 $ checkundo qnew
166 167 $ echo foo > foo
167 168 $ hg phase -r qbase
168 169 0: draft
169 170 $ hg add foo
170 171 $ hg qrefresh
171 172 $ hg phase -r qbase
172 173 0: draft
173 174 $ hg qnew B
174 175 $ echo >> foo
175 176 $ hg qrefresh
176 177 $ echo status >> .hg/patches/.hgignore
177 178 $ echo bleh >> .hg/patches/.hgignore
178 179 $ hg qinit -c
179 180 adding .hg/patches/A (glob)
180 181 adding .hg/patches/B (glob)
181 182 $ hg -R .hg/patches status
182 183 A .hgignore
183 184 A A
184 185 A B
185 186 A series
186 187
187 188 qinit -c shouldn't touch these files if they already exist
188 189
189 190 $ cat .hg/patches/.hgignore
190 191 status
191 192 bleh
192 193 $ cat .hg/patches/series
193 194 A
194 195 B
195 196
196 197 add an untracked file
197 198
198 199 $ echo >> .hg/patches/flaf
199 200
200 201 status --mq with color (issue2096)
201 202
202 203 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
203 204 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
204 205 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
205 206 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
206 207 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
207 208 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
208 209
209 210 try the --mq option on a command provided by an extension
210 211
211 212 $ hg purge --mq --verbose --config extensions.purge=
212 213 removing file flaf
213 214
214 215 $ cd ..
215 216
216 217 #if no-outer-repo
217 218
218 219 init --mq without repo
219 220
220 221 $ mkdir f
221 222 $ cd f
222 223 $ hg init --mq
223 224 abort: there is no Mercurial repository here (.hg not found)
224 225 [255]
225 226 $ cd ..
226 227
227 228 #endif
228 229
229 230 init --mq with repo path
230 231
231 232 $ hg init g
232 233 $ hg init --mq g
233 234 $ test -d g/.hg/patches/.hg
234 235
235 236 init --mq with nonexistent directory
236 237
237 238 $ hg init --mq nonexistentdir
238 239 abort: repository nonexistentdir not found!
239 240 [255]
240 241
241 242
242 243 init --mq with bundle (non "local")
243 244
244 245 $ hg -R a bundle --all a.bundle >/dev/null
245 246 $ hg init --mq a.bundle
246 247 abort: only a local queue repository may be initialized
247 248 [255]
248 249
249 250 $ cd a
250 251
251 252 $ hg qnew -m 'foo bar' test.patch
252 253
253 254 $ echo '# comment' > .hg/patches/series.tmp
254 255 $ echo >> .hg/patches/series.tmp # empty line
255 256 $ cat .hg/patches/series >> .hg/patches/series.tmp
256 257 $ mv .hg/patches/series.tmp .hg/patches/series
257 258
258 259
259 260 qrefresh
260 261
261 262 $ echo a >> a
262 263 $ hg qrefresh
263 264 $ cat .hg/patches/test.patch
264 265 foo bar
265 266
266 267 diff -r [a-f0-9]* a (re)
267 268 --- a/a\t(?P<date>.*) (re)
268 269 \+\+\+ b/a\t(?P<date2>.*) (re)
269 270 @@ -1,1 +1,2 @@
270 271 a
271 272 +a
272 273
273 274 empty qrefresh
274 275
275 276 $ hg qrefresh -X a
276 277
277 278 revision:
278 279
279 280 $ hg diff -r -2 -r -1
280 281
281 282 patch:
282 283
283 284 $ cat .hg/patches/test.patch
284 285 foo bar
285 286
286 287
287 288 working dir diff:
288 289
289 290 $ hg diff --nodates -q
290 291 --- a/a
291 292 +++ b/a
292 293 @@ -1,1 +1,2 @@
293 294 a
294 295 +a
295 296
296 297 restore things
297 298
298 299 $ hg qrefresh
299 300 $ checkundo qrefresh
300 301
301 302
302 303 qpop
303 304
304 305 $ hg qpop
305 306 popping test.patch
306 307 patch queue now empty
307 308 $ checkundo qpop
308 309
309 310
310 311 qpush with dump of tag cache
311 312 Dump the tag cache to ensure that it has exactly one head after qpush.
312 313
313 314 $ rm -f .hg/cache/tags
314 315 $ hg tags > /dev/null
315 316
316 317 .hg/cache/tags (pre qpush):
317 318
318 319 $ cat .hg/cache/tags
319 320 1 [\da-f]{40} (re)
320 321
321 322 $ hg qpush
322 323 applying test.patch
323 324 now at: test.patch
324 325 $ hg phase -r qbase
325 326 2: draft
326 327 $ hg tags > /dev/null
327 328
328 329 .hg/cache/tags (post qpush):
329 330
330 331 $ cat .hg/cache/tags
331 332 2 [\da-f]{40} (re)
332 333
333 334 $ checkundo qpush
334 335 $ cd ..
335 336
336 337
337 338 pop/push outside repo
338 339 $ hg -R a qpop
339 340 popping test.patch
340 341 patch queue now empty
341 342 $ hg -R a qpush
342 343 applying test.patch
343 344 now at: test.patch
344 345
345 346 $ cd a
346 347 $ hg qnew test2.patch
347 348
348 349 qrefresh in subdir
349 350
350 351 $ cd b
351 352 $ echo a > a
352 353 $ hg add a
353 354 $ hg qrefresh
354 355
355 356 pop/push -a in subdir
356 357
357 358 $ hg qpop -a
358 359 popping test2.patch
359 360 popping test.patch
360 361 patch queue now empty
361 362 $ hg --traceback qpush -a
362 363 applying test.patch
363 364 applying test2.patch
364 365 now at: test2.patch
365 366
366 367
367 368 setting columns & formatted tests truncating (issue1912)
368 369
369 370 $ COLUMNS=4 hg qseries --config ui.formatted=true
370 371 test.patch
371 372 test2.patch
372 373 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
373 374 0 A test.patch: f...
374 375 1 A test2.patch:
375 376 $ hg qpop
376 377 popping test2.patch
377 378 now at: test.patch
378 379 $ hg qseries -vs
379 380 0 A test.patch: foo bar
380 381 1 U test2.patch:
381 382 $ hg sum | grep mq
382 383 mq: 1 applied, 1 unapplied
383 384 $ hg qpush
384 385 applying test2.patch
385 386 now at: test2.patch
386 387 $ hg sum | grep mq
387 388 mq: 2 applied
388 389 $ hg qapplied
389 390 test.patch
390 391 test2.patch
391 392 $ hg qtop
392 393 test2.patch
393 394
394 395
395 396 prev
396 397
397 398 $ hg qapp -1
398 399 test.patch
399 400
400 401 next
401 402
402 403 $ hg qunapp -1
403 404 all patches applied
404 405 [1]
405 406
406 407 $ hg qpop
407 408 popping test2.patch
408 409 now at: test.patch
409 410
410 411 commit should fail
411 412
412 413 $ hg commit
413 414 abort: cannot commit over an applied mq patch
414 415 [255]
415 416
416 417 push should fail if draft
417 418
418 419 $ hg push ../../k
419 420 pushing to ../../k
420 421 abort: source has mq patches applied
421 422 [255]
422 423
423 424
424 425 import should fail
425 426
426 427 $ hg st .
427 428 $ echo foo >> ../a
428 429 $ hg diff > ../../import.diff
429 430 $ hg revert --no-backup ../a
430 431 $ hg import ../../import.diff
431 432 abort: cannot import over an applied patch
432 433 [255]
433 434 $ hg st
434 435
435 436 import --no-commit should succeed
436 437
437 438 $ hg import --no-commit ../../import.diff
438 439 applying ../../import.diff
439 440 $ hg st
440 441 M a
441 442 $ hg revert --no-backup ../a
442 443
443 444
444 445 qunapplied
445 446
446 447 $ hg qunapplied
447 448 test2.patch
448 449
449 450
450 451 qpush/qpop with index
451 452
452 453 $ hg qnew test1b.patch
453 454 $ echo 1b > 1b
454 455 $ hg add 1b
455 456 $ hg qrefresh
456 457 $ hg qpush 2
457 458 applying test2.patch
458 459 now at: test2.patch
459 460 $ hg qpop 0
460 461 popping test2.patch
461 462 popping test1b.patch
462 463 now at: test.patch
463 464 $ hg qpush test.patch+1
464 465 applying test1b.patch
465 466 now at: test1b.patch
466 467 $ hg qpush test.patch+2
467 468 applying test2.patch
468 469 now at: test2.patch
469 470 $ hg qpop test2.patch-1
470 471 popping test2.patch
471 472 now at: test1b.patch
472 473 $ hg qpop test2.patch-2
473 474 popping test1b.patch
474 475 now at: test.patch
475 476 $ hg qpush test1b.patch+1
476 477 applying test1b.patch
477 478 applying test2.patch
478 479 now at: test2.patch
479 480
480 481
481 482 qpush --move
482 483
483 484 $ hg qpop -a
484 485 popping test2.patch
485 486 popping test1b.patch
486 487 popping test.patch
487 488 patch queue now empty
488 489 $ hg qguard test1b.patch -- -negguard
489 490 $ hg qguard test2.patch -- +posguard
490 491 $ hg qpush --move test2.patch # can't move guarded patch
491 492 cannot push 'test2.patch' - guarded by '+posguard'
492 493 [1]
493 494 $ hg qselect posguard
494 495 number of unguarded, unapplied patches has changed from 2 to 3
495 496 $ hg qpush --move test2.patch # move to front
496 497 applying test2.patch
497 498 now at: test2.patch
498 499 $ hg qpush --move test1b.patch # negative guard unselected
499 500 applying test1b.patch
500 501 now at: test1b.patch
501 502 $ hg qpush --move test.patch # noop move
502 503 applying test.patch
503 504 now at: test.patch
504 505 $ hg qseries -v
505 506 0 A test2.patch
506 507 1 A test1b.patch
507 508 2 A test.patch
508 509 $ hg qpop -a
509 510 popping test.patch
510 511 popping test1b.patch
511 512 popping test2.patch
512 513 patch queue now empty
513 514
514 515 cleaning up
515 516
516 517 $ hg qselect --none
517 518 guards deactivated
518 519 number of unguarded, unapplied patches has changed from 3 to 2
519 520 $ hg qguard --none test1b.patch
520 521 $ hg qguard --none test2.patch
521 522 $ hg qpush --move test.patch
522 523 applying test.patch
523 524 now at: test.patch
524 525 $ hg qpush --move test1b.patch
525 526 applying test1b.patch
526 527 now at: test1b.patch
527 528 $ hg qpush --move bogus # nonexistent patch
528 529 abort: patch bogus not in series
529 530 [255]
530 531 $ hg qpush --move # no patch
531 532 abort: please specify the patch to move
532 533 [255]
533 534 $ hg qpush --move test.patch # already applied
534 535 abort: cannot push to a previous patch: test.patch
535 536 [255]
536 537 $ sed '2i\
537 538 > # make qtip index different in series and fullseries
538 539 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
539 540 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
540 541 $ cat `hg root`/.hg/patches/series
541 542 # comment
542 543 # make qtip index different in series and fullseries
543 544
544 545 test.patch
545 546 test1b.patch
546 547 test2.patch
547 548 $ hg qpush --move test2.patch
548 549 applying test2.patch
549 550 now at: test2.patch
550 551
551 552
552 553 series after move
553 554
554 555 $ cat `hg root`/.hg/patches/series
555 556 # comment
556 557 # make qtip index different in series and fullseries
557 558
558 559 test.patch
559 560 test1b.patch
560 561 test2.patch
561 562
562 563
563 564 pop, qapplied, qunapplied
564 565
565 566 $ hg qseries -v
566 567 0 A test.patch
567 568 1 A test1b.patch
568 569 2 A test2.patch
569 570
570 571 qapplied -1 test.patch
571 572
572 573 $ hg qapplied -1 test.patch
573 574 only one patch applied
574 575 [1]
575 576
576 577 qapplied -1 test1b.patch
577 578
578 579 $ hg qapplied -1 test1b.patch
579 580 test.patch
580 581
581 582 qapplied -1 test2.patch
582 583
583 584 $ hg qapplied -1 test2.patch
584 585 test1b.patch
585 586
586 587 qapplied -1
587 588
588 589 $ hg qapplied -1
589 590 test1b.patch
590 591
591 592 qapplied
592 593
593 594 $ hg qapplied
594 595 test.patch
595 596 test1b.patch
596 597 test2.patch
597 598
598 599 qapplied test1b.patch
599 600
600 601 $ hg qapplied test1b.patch
601 602 test.patch
602 603 test1b.patch
603 604
604 605 qunapplied -1
605 606
606 607 $ hg qunapplied -1
607 608 all patches applied
608 609 [1]
609 610
610 611 qunapplied
611 612
612 613 $ hg qunapplied
613 614
614 615 popping
615 616
616 617 $ hg qpop
617 618 popping test2.patch
618 619 now at: test1b.patch
619 620
620 621 qunapplied -1
621 622
622 623 $ hg qunapplied -1
623 624 test2.patch
624 625
625 626 qunapplied
626 627
627 628 $ hg qunapplied
628 629 test2.patch
629 630
630 631 qunapplied test2.patch
631 632
632 633 $ hg qunapplied test2.patch
633 634
634 635 qunapplied -1 test2.patch
635 636
636 637 $ hg qunapplied -1 test2.patch
637 638 all patches applied
638 639 [1]
639 640
640 641 popping -a
641 642
642 643 $ hg qpop -a
643 644 popping test1b.patch
644 645 popping test.patch
645 646 patch queue now empty
646 647
647 648 qapplied
648 649
649 650 $ hg qapplied
650 651
651 652 qapplied -1
652 653
653 654 $ hg qapplied -1
654 655 no patches applied
655 656 [1]
656 657 $ hg qpush
657 658 applying test.patch
658 659 now at: test.patch
659 660
660 661
661 662 push should succeed
662 663
663 664 $ hg qpop -a
664 665 popping test.patch
665 666 patch queue now empty
666 667 $ hg push ../../k
667 668 pushing to ../../k
668 669 searching for changes
669 670 adding changesets
670 671 adding manifests
671 672 adding file changes
672 673 added 1 changesets with 1 changes to 1 files
673 674
674 675
675 676 we want to start with some patches applied
676 677
677 678 $ hg qpush -a
678 679 applying test.patch
679 680 applying test1b.patch
680 681 applying test2.patch
681 682 now at: test2.patch
682 683
683 684 % pops all patches and succeeds
684 685
685 686 $ hg qpop -a
686 687 popping test2.patch
687 688 popping test1b.patch
688 689 popping test.patch
689 690 patch queue now empty
690 691
691 692 % does nothing and succeeds
692 693
693 694 $ hg qpop -a
694 695 no patches applied
695 696
696 697 % fails - nothing else to pop
697 698
698 699 $ hg qpop
699 700 no patches applied
700 701 [1]
701 702
702 703 % pushes a patch and succeeds
703 704
704 705 $ hg qpush
705 706 applying test.patch
706 707 now at: test.patch
707 708
708 709 % pops a patch and succeeds
709 710
710 711 $ hg qpop
711 712 popping test.patch
712 713 patch queue now empty
713 714
714 715 % pushes up to test1b.patch and succeeds
715 716
716 717 $ hg qpush test1b.patch
717 718 applying test.patch
718 719 applying test1b.patch
719 720 now at: test1b.patch
720 721
721 722 % does nothing and succeeds
722 723
723 724 $ hg qpush test1b.patch
724 725 qpush: test1b.patch is already at the top
725 726
726 727 % does nothing and succeeds
727 728
728 729 $ hg qpop test1b.patch
729 730 qpop: test1b.patch is already at the top
730 731
731 732 % fails - can't push to this patch
732 733
733 734 $ hg qpush test.patch
734 735 abort: cannot push to a previous patch: test.patch
735 736 [255]
736 737
737 738 % fails - can't pop to this patch
738 739
739 740 $ hg qpop test2.patch
740 741 abort: patch test2.patch is not applied
741 742 [255]
742 743
743 744 % pops up to test.patch and succeeds
744 745
745 746 $ hg qpop test.patch
746 747 popping test1b.patch
747 748 now at: test.patch
748 749
749 750 % pushes all patches and succeeds
750 751
751 752 $ hg qpush -a
752 753 applying test1b.patch
753 754 applying test2.patch
754 755 now at: test2.patch
755 756
756 757 % does nothing and succeeds
757 758
758 759 $ hg qpush -a
759 760 all patches are currently applied
760 761
761 762 % fails - nothing else to push
762 763
763 764 $ hg qpush
764 765 patch series already fully applied
765 766 [1]
766 767
767 768 % does nothing and succeeds
768 769
769 770 $ hg qpush test2.patch
770 771 qpush: test2.patch is already at the top
771 772
772 773 strip
773 774
774 775 $ cd ../../b
775 776 $ echo x>x
776 777 $ hg ci -Ama
777 778 adding x
778 779 $ hg strip tip
779 780 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
780 781 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
781 782 $ hg unbundle .hg/strip-backup/*
782 783 adding changesets
783 784 adding manifests
784 785 adding file changes
785 786 added 1 changesets with 1 changes to 1 files
786 787 (run 'hg update' to get a working copy)
787 788
788 789
789 790 strip with local changes, should complain
790 791
791 792 $ hg up
792 793 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
793 794 $ echo y>y
794 795 $ hg add y
795 796 $ hg strip tip
796 797 abort: local changes found
797 798 [255]
798 799
799 800 --force strip with local changes
800 801
801 802 $ hg strip -f tip
802 803 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
803 804 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
804 805 $ cd ..
805 806
806 807
807 808 cd b; hg qrefresh
808 809
809 810 $ hg init refresh
810 811 $ cd refresh
811 812 $ echo a > a
812 813 $ hg ci -Ama
813 814 adding a
814 815 $ hg qnew -mfoo foo
815 816 $ echo a >> a
816 817 $ hg qrefresh
817 818 $ mkdir b
818 819 $ cd b
819 820 $ echo f > f
820 821 $ hg add f
821 822 $ hg qrefresh
822 823 $ cat ../.hg/patches/foo
823 824 foo
824 825
825 826 diff -r cb9a9f314b8b a
826 827 --- a/a\t(?P<date>.*) (re)
827 828 \+\+\+ b/a\t(?P<date>.*) (re)
828 829 @@ -1,1 +1,2 @@
829 830 a
830 831 +a
831 832 diff -r cb9a9f314b8b b/f
832 833 --- /dev/null\t(?P<date>.*) (re)
833 834 \+\+\+ b/b/f\t(?P<date>.*) (re)
834 835 @@ -0,0 +1,1 @@
835 836 +f
836 837
837 838 hg qrefresh .
838 839
839 840 $ hg qrefresh .
840 841 $ cat ../.hg/patches/foo
841 842 foo
842 843
843 844 diff -r cb9a9f314b8b b/f
844 845 --- /dev/null\t(?P<date>.*) (re)
845 846 \+\+\+ b/b/f\t(?P<date>.*) (re)
846 847 @@ -0,0 +1,1 @@
847 848 +f
848 849 $ hg status
849 850 M a
850 851
851 852
852 853 qpush failure
853 854
854 855 $ cd ..
855 856 $ hg qrefresh
856 857 $ hg qnew -mbar bar
857 858 $ echo foo > foo
858 859 $ echo bar > bar
859 860 $ hg add foo bar
860 861 $ hg qrefresh
861 862 $ hg qpop -a
862 863 popping bar
863 864 popping foo
864 865 patch queue now empty
865 866 $ echo bar > foo
866 867 $ hg qpush -a
867 868 applying foo
868 869 applying bar
869 870 file foo already exists
870 871 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
871 872 patch failed, unable to continue (try -v)
872 873 patch failed, rejects left in working dir
873 874 errors during apply, please fix and refresh bar
874 875 [2]
875 876 $ hg st
876 877 ? foo
877 878 ? foo.rej
878 879
879 880
880 881 mq tags
881 882
882 883 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
883 884 0 qparent
884 885 1 foo qbase
885 886 2 bar qtip tip
886 887
887 888 mq revset
888 889
889 890 $ hg log -r 'mq()' --template '{rev}\n'
890 891 1
891 892 2
892 893 $ hg help revsets | grep -i mq
893 894 "mq()"
894 895 Changesets managed by MQ.
895 896
896 897 bad node in status
897 898
898 899 $ hg qpop
899 900 popping bar
900 901 now at: foo
901 902 $ hg strip -qn tip
902 903 $ hg tip
903 904 changeset: 0:cb9a9f314b8b
904 905 tag: tip
905 906 user: test
906 907 date: Thu Jan 01 00:00:00 1970 +0000
907 908 summary: a
908 909
909 910 $ hg branches
910 911 default 0:cb9a9f314b8b
911 912 $ hg qpop
912 913 no patches applied
913 914 [1]
914 915
915 916 $ cd ..
916 917
917 918
918 919 git patches
919 920
920 921 $ cat >>$HGRCPATH <<EOF
921 922 > [diff]
922 923 > git = True
923 924 > EOF
924 925 $ hg init git
925 926 $ cd git
926 927 $ hg qinit
927 928
928 929 $ hg qnew -m'new file' new
929 930 $ echo foo > new
930 931 #if execbit
931 932 $ chmod +x new
932 933 #endif
933 934 $ hg add new
934 935 $ hg qrefresh
935 936 #if execbit
936 937 $ cat .hg/patches/new
937 938 new file
938 939
939 940 diff --git a/new b/new
940 941 new file mode 100755
941 942 --- /dev/null
942 943 +++ b/new
943 944 @@ -0,0 +1,1 @@
944 945 +foo
945 946 #else
946 947 $ cat .hg/patches/new
947 948 new file
948 949
949 950 diff --git a/new b/new
950 951 new file mode 100644
951 952 --- /dev/null
952 953 +++ b/new
953 954 @@ -0,0 +1,1 @@
954 955 +foo
955 956 #endif
956 957
957 958 $ hg qnew -m'copy file' copy
958 959 $ hg cp new copy
959 960 $ hg qrefresh
960 961 $ cat .hg/patches/copy
961 962 copy file
962 963
963 964 diff --git a/new b/copy
964 965 copy from new
965 966 copy to copy
966 967
967 968 $ hg qpop
968 969 popping copy
969 970 now at: new
970 971 $ hg qpush
971 972 applying copy
972 973 now at: copy
973 974 $ hg qdiff
974 975 diff --git a/new b/copy
975 976 copy from new
976 977 copy to copy
977 978 $ cat >>$HGRCPATH <<EOF
978 979 > [diff]
979 980 > git = False
980 981 > EOF
981 982 $ hg qdiff --git
982 983 diff --git a/new b/copy
983 984 copy from new
984 985 copy to copy
985 986 $ cd ..
986 987
987 988 empty lines in status
988 989
989 990 $ hg init emptystatus
990 991 $ cd emptystatus
991 992 $ hg qinit
992 993 $ printf '\n\n' > .hg/patches/status
993 994 $ hg qser
994 995 $ cd ..
995 996
996 997 bad line in status (without ":")
997 998
998 999 $ hg init badstatus
999 1000 $ cd badstatus
1000 1001 $ hg qinit
1001 1002 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1002 1003 $ hg qser
1003 1004 malformated mq status line: ['babar has no colon in this line']
1004 1005 $ cd ..
1005 1006
1006 1007
1007 1008 test file addition in slow path
1008 1009
1009 1010 $ hg init slow
1010 1011 $ cd slow
1011 1012 $ hg qinit
1012 1013 $ echo foo > foo
1013 1014 $ hg add foo
1014 1015 $ hg ci -m 'add foo'
1015 1016 $ hg qnew bar
1016 1017 $ echo bar > bar
1017 1018 $ hg add bar
1018 1019 $ hg mv foo baz
1019 1020 $ hg qrefresh --git
1020 1021 $ hg up -C 0
1021 1022 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1022 1023 $ echo >> foo
1023 1024 $ hg ci -m 'change foo'
1024 1025 created new head
1025 1026 $ hg up -C 1
1026 1027 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1027 1028 $ hg qrefresh --git
1028 1029 $ cat .hg/patches/bar
1029 1030 diff --git a/bar b/bar
1030 1031 new file mode 100644
1031 1032 --- /dev/null
1032 1033 +++ b/bar
1033 1034 @@ -0,0 +1,1 @@
1034 1035 +bar
1035 1036 diff --git a/foo b/baz
1036 1037 rename from foo
1037 1038 rename to baz
1038 1039 $ hg log -v --template '{rev} {file_copies}\n' -r .
1039 1040 2 baz (foo)
1040 1041 $ hg qrefresh --git
1041 1042 $ cat .hg/patches/bar
1042 1043 diff --git a/bar b/bar
1043 1044 new file mode 100644
1044 1045 --- /dev/null
1045 1046 +++ b/bar
1046 1047 @@ -0,0 +1,1 @@
1047 1048 +bar
1048 1049 diff --git a/foo b/baz
1049 1050 rename from foo
1050 1051 rename to baz
1051 1052 $ hg log -v --template '{rev} {file_copies}\n' -r .
1052 1053 2 baz (foo)
1053 1054 $ hg qrefresh
1054 1055 $ grep 'diff --git' .hg/patches/bar
1055 1056 diff --git a/bar b/bar
1056 1057 diff --git a/foo b/baz
1057 1058
1058 1059
1059 1060 test file move chains in the slow path
1060 1061
1061 1062 $ hg up -C 1
1062 1063 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1063 1064 $ echo >> foo
1064 1065 $ hg ci -m 'change foo again'
1065 1066 $ hg up -C 2
1066 1067 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1067 1068 $ hg mv bar quux
1068 1069 $ hg mv baz bleh
1069 1070 $ hg qrefresh --git
1070 1071 $ cat .hg/patches/bar
1071 1072 diff --git a/foo b/bleh
1072 1073 rename from foo
1073 1074 rename to bleh
1074 1075 diff --git a/quux b/quux
1075 1076 new file mode 100644
1076 1077 --- /dev/null
1077 1078 +++ b/quux
1078 1079 @@ -0,0 +1,1 @@
1079 1080 +bar
1080 1081 $ hg log -v --template '{rev} {file_copies}\n' -r .
1081 1082 3 bleh (foo)
1082 1083 $ hg mv quux fred
1083 1084 $ hg mv bleh barney
1084 1085 $ hg qrefresh --git
1085 1086 $ cat .hg/patches/bar
1086 1087 diff --git a/foo b/barney
1087 1088 rename from foo
1088 1089 rename to barney
1089 1090 diff --git a/fred b/fred
1090 1091 new file mode 100644
1091 1092 --- /dev/null
1092 1093 +++ b/fred
1093 1094 @@ -0,0 +1,1 @@
1094 1095 +bar
1095 1096 $ hg log -v --template '{rev} {file_copies}\n' -r .
1096 1097 3 barney (foo)
1097 1098
1098 1099
1099 1100 refresh omitting an added file
1100 1101
1101 1102 $ hg qnew baz
1102 1103 $ echo newfile > newfile
1103 1104 $ hg add newfile
1104 1105 $ hg qrefresh
1105 1106 $ hg st -A newfile
1106 1107 C newfile
1107 1108 $ hg qrefresh -X newfile
1108 1109 $ hg st -A newfile
1109 1110 A newfile
1110 1111 $ hg revert newfile
1111 1112 $ rm newfile
1112 1113 $ hg qpop
1113 1114 popping baz
1114 1115 now at: bar
1115 1116
1116 1117 test qdel/qrm
1117 1118
1118 1119 $ hg qdel baz
1119 1120 $ echo p >> .hg/patches/series
1120 1121 $ hg qrm p
1121 1122 $ hg qser
1122 1123 bar
1123 1124
1124 1125 create a git patch
1125 1126
1126 1127 $ echo a > alexander
1127 1128 $ hg add alexander
1128 1129 $ hg qnew -f --git addalexander
1129 1130 $ grep diff .hg/patches/addalexander
1130 1131 diff --git a/alexander b/alexander
1131 1132
1132 1133
1133 1134 create a git binary patch
1134 1135
1135 1136 $ cat > writebin.py <<EOF
1136 1137 > import sys
1137 1138 > path = sys.argv[1]
1138 1139 > open(path, 'wb').write('BIN\x00ARY')
1139 1140 > EOF
1140 1141 $ python writebin.py bucephalus
1141 1142
1142 1143 $ python "$TESTDIR/md5sum.py" bucephalus
1143 1144 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1144 1145 $ hg add bucephalus
1145 1146 $ hg qnew -f --git addbucephalus
1146 1147 $ grep diff .hg/patches/addbucephalus
1147 1148 diff --git a/bucephalus b/bucephalus
1148 1149
1149 1150
1150 1151 check binary patches can be popped and pushed
1151 1152
1152 1153 $ hg qpop
1153 1154 popping addbucephalus
1154 1155 now at: addalexander
1155 1156 $ test -f bucephalus && echo % bucephalus should not be there
1156 1157 [1]
1157 1158 $ hg qpush
1158 1159 applying addbucephalus
1159 1160 now at: addbucephalus
1160 1161 $ test -f bucephalus
1161 1162 $ python "$TESTDIR/md5sum.py" bucephalus
1162 1163 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1163 1164
1164 1165
1165 1166
1166 1167 strip again
1167 1168
1168 1169 $ cd ..
1169 1170 $ hg init strip
1170 1171 $ cd strip
1171 1172 $ touch foo
1172 1173 $ hg add foo
1173 1174 $ hg ci -m 'add foo'
1174 1175 $ echo >> foo
1175 1176 $ hg ci -m 'change foo 1'
1176 1177 $ hg up -C 0
1177 1178 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1178 1179 $ echo 1 >> foo
1179 1180 $ hg ci -m 'change foo 2'
1180 1181 created new head
1181 1182 $ HGMERGE=true hg merge
1182 1183 merging foo
1183 1184 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1184 1185 (branch merge, don't forget to commit)
1185 1186 $ hg ci -m merge
1186 1187 $ hg log
1187 1188 changeset: 3:99615015637b
1188 1189 tag: tip
1189 1190 parent: 2:20cbbe65cff7
1190 1191 parent: 1:d2871fc282d4
1191 1192 user: test
1192 1193 date: Thu Jan 01 00:00:00 1970 +0000
1193 1194 summary: merge
1194 1195
1195 1196 changeset: 2:20cbbe65cff7
1196 1197 parent: 0:53245c60e682
1197 1198 user: test
1198 1199 date: Thu Jan 01 00:00:00 1970 +0000
1199 1200 summary: change foo 2
1200 1201
1201 1202 changeset: 1:d2871fc282d4
1202 1203 user: test
1203 1204 date: Thu Jan 01 00:00:00 1970 +0000
1204 1205 summary: change foo 1
1205 1206
1206 1207 changeset: 0:53245c60e682
1207 1208 user: test
1208 1209 date: Thu Jan 01 00:00:00 1970 +0000
1209 1210 summary: add foo
1210 1211
1211 1212 $ hg strip 1
1212 1213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1213 1214 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1214 1215 $ checkundo strip
1215 1216 $ hg log
1216 1217 changeset: 1:20cbbe65cff7
1217 1218 tag: tip
1218 1219 user: test
1219 1220 date: Thu Jan 01 00:00:00 1970 +0000
1220 1221 summary: change foo 2
1221 1222
1222 1223 changeset: 0:53245c60e682
1223 1224 user: test
1224 1225 date: Thu Jan 01 00:00:00 1970 +0000
1225 1226 summary: add foo
1226 1227
1227 1228 $ cd ..
1228 1229
1229 1230
1230 1231 qclone
1231 1232
1232 1233 $ qlog()
1233 1234 > {
1234 1235 > echo 'main repo:'
1235 1236 > hg log --template ' rev {rev}: {desc}\n'
1236 1237 > echo 'patch repo:'
1237 1238 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1238 1239 > }
1239 1240 $ hg init qclonesource
1240 1241 $ cd qclonesource
1241 1242 $ echo foo > foo
1242 1243 $ hg add foo
1243 1244 $ hg ci -m 'add foo'
1244 1245 $ hg qinit
1245 1246 $ hg qnew patch1
1246 1247 $ echo bar >> foo
1247 1248 $ hg qrefresh -m 'change foo'
1248 1249 $ cd ..
1249 1250
1250 1251
1251 1252 repo with unversioned patch dir
1252 1253
1253 1254 $ hg qclone qclonesource failure
1254 1255 abort: versioned patch repository not found (see init --mq)
1255 1256 [255]
1256 1257
1257 1258 $ cd qclonesource
1258 1259 $ hg qinit -c
1259 1260 adding .hg/patches/patch1 (glob)
1260 1261 $ hg qci -m checkpoint
1261 1262 $ qlog
1262 1263 main repo:
1263 1264 rev 1: change foo
1264 1265 rev 0: add foo
1265 1266 patch repo:
1266 1267 rev 0: checkpoint
1267 1268 $ cd ..
1268 1269
1269 1270
1270 1271 repo with patches applied
1271 1272
1272 1273 $ hg qclone qclonesource qclonedest
1273 1274 updating to branch default
1274 1275 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1275 1276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1276 1277 $ cd qclonedest
1277 1278 $ qlog
1278 1279 main repo:
1279 1280 rev 0: add foo
1280 1281 patch repo:
1281 1282 rev 0: checkpoint
1282 1283 $ cd ..
1283 1284
1284 1285
1285 1286 repo with patches unapplied
1286 1287
1287 1288 $ cd qclonesource
1288 1289 $ hg qpop -a
1289 1290 popping patch1
1290 1291 patch queue now empty
1291 1292 $ qlog
1292 1293 main repo:
1293 1294 rev 0: add foo
1294 1295 patch repo:
1295 1296 rev 0: checkpoint
1296 1297 $ cd ..
1297 1298 $ hg qclone qclonesource qclonedest2
1298 1299 updating to branch default
1299 1300 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1300 1301 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1301 1302 $ cd qclonedest2
1302 1303 $ qlog
1303 1304 main repo:
1304 1305 rev 0: add foo
1305 1306 patch repo:
1306 1307 rev 0: checkpoint
1307 1308 $ cd ..
1308 1309
1309 1310
1310 1311 Issue1033: test applying on an empty file
1311 1312
1312 1313 $ hg init empty
1313 1314 $ cd empty
1314 1315 $ touch a
1315 1316 $ hg ci -Am addempty
1316 1317 adding a
1317 1318 $ echo a > a
1318 1319 $ hg qnew -f -e changea
1319 1320 $ hg qpop
1320 1321 popping changea
1321 1322 patch queue now empty
1322 1323 $ hg qpush
1323 1324 applying changea
1324 1325 now at: changea
1325 1326 $ cd ..
1326 1327
1327 1328 test qpush with --force, issue1087
1328 1329
1329 1330 $ hg init forcepush
1330 1331 $ cd forcepush
1331 1332 $ echo hello > hello.txt
1332 1333 $ echo bye > bye.txt
1333 1334 $ hg ci -Ama
1334 1335 adding bye.txt
1335 1336 adding hello.txt
1336 1337 $ hg qnew -d '0 0' empty
1337 1338 $ hg qpop
1338 1339 popping empty
1339 1340 patch queue now empty
1340 1341 $ echo world >> hello.txt
1341 1342
1342 1343
1343 1344 qpush should fail, local changes
1344 1345
1345 1346 $ hg qpush
1346 1347 abort: local changes found
1347 1348 [255]
1348 1349
1349 1350
1350 1351 apply force, should not discard changes with empty patch
1351 1352
1352 1353 $ hg qpush -f
1353 1354 applying empty
1354 1355 patch empty is empty
1355 1356 now at: empty
1356 1357 $ hg diff --config diff.nodates=True
1357 1358 diff -r d58265112590 hello.txt
1358 1359 --- a/hello.txt
1359 1360 +++ b/hello.txt
1360 1361 @@ -1,1 +1,2 @@
1361 1362 hello
1362 1363 +world
1363 1364 $ hg qdiff --config diff.nodates=True
1364 1365 diff -r 9ecee4f634e3 hello.txt
1365 1366 --- a/hello.txt
1366 1367 +++ b/hello.txt
1367 1368 @@ -1,1 +1,2 @@
1368 1369 hello
1369 1370 +world
1370 1371 $ hg log -l1 -p
1371 1372 changeset: 1:d58265112590
1372 1373 tag: empty
1373 1374 tag: qbase
1374 1375 tag: qtip
1375 1376 tag: tip
1376 1377 user: test
1377 1378 date: Thu Jan 01 00:00:00 1970 +0000
1378 1379 summary: imported patch empty
1379 1380
1380 1381
1381 1382 $ hg qref -d '0 0'
1382 1383 $ hg qpop
1383 1384 popping empty
1384 1385 patch queue now empty
1385 1386 $ echo universe >> hello.txt
1386 1387 $ echo universe >> bye.txt
1387 1388
1388 1389
1389 1390 qpush should fail, local changes
1390 1391
1391 1392 $ hg qpush
1392 1393 abort: local changes found
1393 1394 [255]
1394 1395
1395 1396
1396 1397 apply force, should discard changes in hello, but not bye
1397 1398
1398 1399 $ hg qpush -f --verbose
1399 1400 applying empty
1400 1401 saving current version of hello.txt as hello.txt.orig
1401 1402 patching file hello.txt
1402 1403 hello.txt
1403 1404 now at: empty
1404 1405 $ hg st
1405 1406 M bye.txt
1406 1407 ? hello.txt.orig
1407 1408 $ hg diff --config diff.nodates=True
1408 1409 diff -r ba252371dbc1 bye.txt
1409 1410 --- a/bye.txt
1410 1411 +++ b/bye.txt
1411 1412 @@ -1,1 +1,2 @@
1412 1413 bye
1413 1414 +universe
1414 1415 $ hg qdiff --config diff.nodates=True
1415 1416 diff -r 9ecee4f634e3 bye.txt
1416 1417 --- a/bye.txt
1417 1418 +++ b/bye.txt
1418 1419 @@ -1,1 +1,2 @@
1419 1420 bye
1420 1421 +universe
1421 1422 diff -r 9ecee4f634e3 hello.txt
1422 1423 --- a/hello.txt
1423 1424 +++ b/hello.txt
1424 1425 @@ -1,1 +1,3 @@
1425 1426 hello
1426 1427 +world
1427 1428 +universe
1428 1429
1429 1430
1430 1431 test popping revisions not in working dir ancestry
1431 1432
1432 1433 $ hg qseries -v
1433 1434 0 A empty
1434 1435 $ hg up qparent
1435 1436 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1436 1437 $ hg qpop
1437 1438 popping empty
1438 1439 patch queue now empty
1439 1440
1440 1441 $ cd ..
1441 1442 $ hg init deletion-order
1442 1443 $ cd deletion-order
1443 1444
1444 1445 $ touch a
1445 1446 $ hg ci -Aqm0
1446 1447
1447 1448 $ hg qnew rename-dir
1448 1449 $ hg rm a
1449 1450 $ hg qrefresh
1450 1451
1451 1452 $ mkdir a b
1452 1453 $ touch a/a b/b
1453 1454 $ hg add -q a b
1454 1455 $ hg qrefresh
1455 1456
1456 1457
1457 1458 test popping must remove files added in subdirectories first
1458 1459
1459 1460 $ hg qpop
1460 1461 popping rename-dir
1461 1462 patch queue now empty
1462 1463 $ cd ..
1463 1464
1464 1465
1465 1466 test case preservation through patch pushing especially on case
1466 1467 insensitive filesystem
1467 1468
1468 1469 $ hg init casepreserve
1469 1470 $ cd casepreserve
1470 1471
1471 1472 $ hg qnew add-file1
1472 1473 $ echo a > TeXtFiLe.TxT
1473 1474 $ hg add TeXtFiLe.TxT
1474 1475 $ hg qrefresh
1475 1476
1476 1477 $ hg qnew add-file2
1477 1478 $ echo b > AnOtHeRFiLe.TxT
1478 1479 $ hg add AnOtHeRFiLe.TxT
1479 1480 $ hg qrefresh
1480 1481
1481 1482 $ hg qnew modify-file
1482 1483 $ echo c >> AnOtHeRFiLe.TxT
1483 1484 $ hg qrefresh
1484 1485
1485 1486 $ hg qapplied
1486 1487 add-file1
1487 1488 add-file2
1488 1489 modify-file
1489 1490 $ hg qpop -a
1490 1491 popping modify-file
1491 1492 popping add-file2
1492 1493 popping add-file1
1493 1494 patch queue now empty
1494 1495
1495 1496 this qpush causes problems below, if case preservation on case
1496 1497 insensitive filesystem is not enough:
1497 1498 (1) unexpected "adding ..." messages are shown
1498 1499 (2) patching fails in modification of (1) files
1499 1500
1500 1501 $ hg qpush -a
1501 1502 applying add-file1
1502 1503 applying add-file2
1503 1504 applying modify-file
1504 1505 now at: modify-file
1505 1506
1506 1507 Proper phase default with mq:
1507 1508
1508 1509 1. mq.secret=false
1509 1510
1510 1511 $ rm .hg/store/phaseroots
1511 1512 $ hg phase 'qparent::'
1512 1513 -1: public
1513 1514 0: draft
1514 1515 1: draft
1515 1516 2: draft
1516 1517 $ echo '[mq]' >> $HGRCPATH
1517 1518 $ echo 'secret=true' >> $HGRCPATH
1518 1519 $ rm -f .hg/store/phaseroots
1519 1520 $ hg phase 'qparent::'
1520 1521 -1: public
1521 1522 0: secret
1522 1523 1: secret
1523 1524 2: secret
1524 1525
1525 1526 Test that qfinish change phase when mq.secret=true
1526 1527
1527 1528 $ hg qfinish qbase
1528 1529 patch add-file1 finalized without changeset message
1529 1530 $ hg phase 'all()'
1530 1531 0: draft
1531 1532 1: secret
1532 1533 2: secret
1533 1534
1534 1535 Test that qfinish respect phases.new-commit setting
1535 1536
1536 1537 $ echo '[phases]' >> $HGRCPATH
1537 1538 $ echo 'new-commit=secret' >> $HGRCPATH
1538 1539 $ hg qfinish qbase
1539 1540 patch add-file2 finalized without changeset message
1540 1541 $ hg phase 'all()'
1541 1542 0: draft
1542 1543 1: secret
1543 1544 2: secret
1544 1545
1545 1546 (restore env for next test)
1546 1547
1547 1548 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1548 1549 $ cp $TESTTMP/sedtmp $HGRCPATH
1549 1550 $ hg qimport -r 1 --name add-file2
1550 1551
1551 1552 Test that qfinish preserve phase when mq.secret=false
1552 1553
1553 1554 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1554 1555 $ cp $TESTTMP/sedtmp $HGRCPATH
1555 1556 $ hg qfinish qbase
1556 1557 patch add-file2 finalized without changeset message
1557 1558 $ hg phase 'all()'
1558 1559 0: draft
1559 1560 1: secret
1560 1561 2: secret
1561 1562
1562 1563 Test that secret mq patch does not break hgweb
1563 1564
1564 1565 $ cat > hgweb.cgi <<HGWEB
1565 1566 > from mercurial import demandimport; demandimport.enable()
1566 1567 > from mercurial.hgweb import hgweb
1567 1568 > from mercurial.hgweb import wsgicgi
1568 1569 > import cgitb
1569 1570 > cgitb.enable()
1570 1571 > app = hgweb('.', 'test')
1571 1572 > wsgicgi.launch(app)
1572 1573 > HGWEB
1573 1574 $ . "$TESTDIR/cgienv"
1574 1575 #if msys
1575 1576 $ PATH_INFO=//tags; export PATH_INFO
1576 1577 #else
1577 1578 $ PATH_INFO=/tags; export PATH_INFO
1578 1579 #endif
1579 1580 $ QUERY_STRING='style=raw'
1580 1581 $ python hgweb.cgi | grep '^tip'
1581 1582 tip [0-9a-f]{40} (re)
1582 1583
1583 1584 $ cd ..
1584 1585
1585 1586 Test interaction with revset (issue4426)
1586 1587
1587 1588 $ hg init issue4426
1588 1589 $ cd issue4426
1589 1590
1590 1591 $ echo a > a
1591 1592 $ hg ci -Am a
1592 1593 adding a
1593 1594 $ echo a >> a
1594 1595 $ hg ci -m a
1595 1596 $ echo a >> a
1596 1597 $ hg ci -m a
1597 1598 $ hg qimport -r 0::
1598 1599
1599 1600 reimport things
1600 1601
1601 1602 $ hg qimport -r 1::
1602 1603 abort: revision 2 is already managed
1603 1604 [255]
1604 1605
1605 1606
1606 1607 $ cd ..
@@ -1,1377 +1,1379 b''
1 1 Set up a repo
2 2
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "record=" >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
5 > interactive = true
6 > [extensions]
7 > record =
8 > EOF
7 9
8 10 $ hg init a
9 11 $ cd a
10 12
11 13 Select no files
12 14
13 15 $ touch empty-rw
14 16 $ hg add empty-rw
15 17
16 18 $ hg record empty-rw<<EOF
17 19 > n
18 20 > EOF
19 21 diff --git a/empty-rw b/empty-rw
20 22 new file mode 100644
21 23 examine changes to 'empty-rw'? [Ynesfdaq?] n
22 24
23 25 no changes to record
24 26
25 27 $ hg tip -p
26 28 changeset: -1:000000000000
27 29 tag: tip
28 30 user:
29 31 date: Thu Jan 01 00:00:00 1970 +0000
30 32
31 33
32 34
33 35 Select files but no hunks
34 36
35 37 $ hg record empty-rw<<EOF
36 38 > y
37 39 > n
38 40 > EOF
39 41 diff --git a/empty-rw b/empty-rw
40 42 new file mode 100644
41 43 examine changes to 'empty-rw'? [Ynesfdaq?] y
42 44
43 45 abort: empty commit message
44 46 [255]
45 47
46 48 $ hg tip -p
47 49 changeset: -1:000000000000
48 50 tag: tip
49 51 user:
50 52 date: Thu Jan 01 00:00:00 1970 +0000
51 53
52 54
53 55
54 56 Record empty file
55 57
56 58 $ hg record -d '0 0' -m empty empty-rw<<EOF
57 59 > y
58 60 > y
59 61 > EOF
60 62 diff --git a/empty-rw b/empty-rw
61 63 new file mode 100644
62 64 examine changes to 'empty-rw'? [Ynesfdaq?] y
63 65
64 66
65 67 $ hg tip -p
66 68 changeset: 0:c0708cf4e46e
67 69 tag: tip
68 70 user: test
69 71 date: Thu Jan 01 00:00:00 1970 +0000
70 72 summary: empty
71 73
72 74
73 75
74 76 Summary shows we updated to the new cset
75 77
76 78 $ hg summary
77 79 parent: 0:c0708cf4e46e tip
78 80 empty
79 81 branch: default
80 82 commit: (clean)
81 83 update: (current)
82 84
83 85 Rename empty file
84 86
85 87 $ hg mv empty-rw empty-rename
86 88 $ hg record -d '1 0' -m rename<<EOF
87 89 > y
88 90 > EOF
89 91 diff --git a/empty-rw b/empty-rename
90 92 rename from empty-rw
91 93 rename to empty-rename
92 94 examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y
93 95
94 96
95 97 $ hg tip -p
96 98 changeset: 1:d695e8dcb197
97 99 tag: tip
98 100 user: test
99 101 date: Thu Jan 01 00:00:01 1970 +0000
100 102 summary: rename
101 103
102 104
103 105
104 106 Copy empty file
105 107
106 108 $ hg cp empty-rename empty-copy
107 109 $ hg record -d '2 0' -m copy<<EOF
108 110 > y
109 111 > EOF
110 112 diff --git a/empty-rename b/empty-copy
111 113 copy from empty-rename
112 114 copy to empty-copy
113 115 examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y
114 116
115 117
116 118 $ hg tip -p
117 119 changeset: 2:1d4b90bea524
118 120 tag: tip
119 121 user: test
120 122 date: Thu Jan 01 00:00:02 1970 +0000
121 123 summary: copy
122 124
123 125
124 126
125 127 Delete empty file
126 128
127 129 $ hg rm empty-copy
128 130 $ hg record -d '3 0' -m delete<<EOF
129 131 > y
130 132 > EOF
131 133 diff --git a/empty-copy b/empty-copy
132 134 deleted file mode 100644
133 135 examine changes to 'empty-copy'? [Ynesfdaq?] y
134 136
135 137
136 138 $ hg tip -p
137 139 changeset: 3:b39a238f01a1
138 140 tag: tip
139 141 user: test
140 142 date: Thu Jan 01 00:00:03 1970 +0000
141 143 summary: delete
142 144
143 145
144 146
145 147 Add binary file
146 148
147 149 $ hg bundle --base -2 tip.bundle
148 150 1 changesets found
149 151 $ hg add tip.bundle
150 152 $ hg record -d '4 0' -m binary<<EOF
151 153 > y
152 154 > EOF
153 155 diff --git a/tip.bundle b/tip.bundle
154 156 new file mode 100644
155 157 this is a binary file
156 158 examine changes to 'tip.bundle'? [Ynesfdaq?] y
157 159
158 160
159 161 $ hg tip -p
160 162 changeset: 4:ad816da3711e
161 163 tag: tip
162 164 user: test
163 165 date: Thu Jan 01 00:00:04 1970 +0000
164 166 summary: binary
165 167
166 168 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
167 169 Binary file tip.bundle has changed
168 170
169 171
170 172 Change binary file
171 173
172 174 $ hg bundle --base -2 tip.bundle
173 175 1 changesets found
174 176 $ hg record -d '5 0' -m binary-change<<EOF
175 177 > y
176 178 > EOF
177 179 diff --git a/tip.bundle b/tip.bundle
178 180 this modifies a binary file (all or nothing)
179 181 examine changes to 'tip.bundle'? [Ynesfdaq?] y
180 182
181 183
182 184 $ hg tip -p
183 185 changeset: 5:dccd6f3eb485
184 186 tag: tip
185 187 user: test
186 188 date: Thu Jan 01 00:00:05 1970 +0000
187 189 summary: binary-change
188 190
189 191 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
190 192 Binary file tip.bundle has changed
191 193
192 194
193 195 Rename and change binary file
194 196
195 197 $ hg mv tip.bundle top.bundle
196 198 $ hg bundle --base -2 top.bundle
197 199 1 changesets found
198 200 $ hg record -d '6 0' -m binary-change-rename<<EOF
199 201 > y
200 202 > EOF
201 203 diff --git a/tip.bundle b/top.bundle
202 204 rename from tip.bundle
203 205 rename to top.bundle
204 206 this modifies a binary file (all or nothing)
205 207 examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y
206 208
207 209
208 210 $ hg tip -p
209 211 changeset: 6:7fa44105f5b3
210 212 tag: tip
211 213 user: test
212 214 date: Thu Jan 01 00:00:06 1970 +0000
213 215 summary: binary-change-rename
214 216
215 217 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
216 218 Binary file tip.bundle has changed
217 219 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
218 220 Binary file top.bundle has changed
219 221
220 222
221 223 Add plain file
222 224
223 225 $ for i in 1 2 3 4 5 6 7 8 9 10; do
224 226 > echo $i >> plain
225 227 > done
226 228
227 229 $ hg add plain
228 230 $ hg record -d '7 0' -m plain plain<<EOF
229 231 > y
230 232 > y
231 233 > EOF
232 234 diff --git a/plain b/plain
233 235 new file mode 100644
234 236 examine changes to 'plain'? [Ynesfdaq?] y
235 237
236 238
237 239 $ hg tip -p
238 240 changeset: 7:11fb457c1be4
239 241 tag: tip
240 242 user: test
241 243 date: Thu Jan 01 00:00:07 1970 +0000
242 244 summary: plain
243 245
244 246 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
245 247 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
246 248 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
247 249 @@ -0,0 +1,10 @@
248 250 +1
249 251 +2
250 252 +3
251 253 +4
252 254 +5
253 255 +6
254 256 +7
255 257 +8
256 258 +9
257 259 +10
258 260
259 261 Modify end of plain file with username unset
260 262
261 263 $ echo 11 >> plain
262 264 $ unset HGUSER
263 265 $ hg record --config ui.username= -d '8 0' -m end plain
264 266 abort: no username supplied
265 267 (use "hg config --edit" to set your username)
266 268 [255]
267 269
268 270
269 271 Modify end of plain file, also test that diffopts are accounted for
270 272
271 273 $ HGUSER="test"
272 274 $ export HGUSER
273 275 $ hg record --config diff.showfunc=true -d '8 0' -m end plain <<EOF
274 276 > y
275 277 > y
276 278 > EOF
277 279 diff --git a/plain b/plain
278 280 1 hunks, 1 lines changed
279 281 examine changes to 'plain'? [Ynesfdaq?] y
280 282
281 283 @@ -8,3 +8,4 @@ 7
282 284 8
283 285 9
284 286 10
285 287 +11
286 288 record this change to 'plain'? [Ynesfdaq?] y
287 289
288 290
289 291 Modify end of plain file, no EOL
290 292
291 293 $ hg tip --template '{node}' >> plain
292 294 $ hg record -d '9 0' -m noeol plain <<EOF
293 295 > y
294 296 > y
295 297 > EOF
296 298 diff --git a/plain b/plain
297 299 1 hunks, 1 lines changed
298 300 examine changes to 'plain'? [Ynesfdaq?] y
299 301
300 302 @@ -9,3 +9,4 @@
301 303 9
302 304 10
303 305 11
304 306 +7264f99c5f5ff3261504828afa4fb4d406c3af54
305 307 \ No newline at end of file
306 308 record this change to 'plain'? [Ynesfdaq?] y
307 309
308 310
309 311 Modify end of plain file, add EOL
310 312
311 313 $ echo >> plain
312 314 $ echo 1 > plain2
313 315 $ hg add plain2
314 316 $ hg record -d '10 0' -m eol plain plain2 <<EOF
315 317 > y
316 318 > y
317 319 > y
318 320 > EOF
319 321 diff --git a/plain b/plain
320 322 1 hunks, 1 lines changed
321 323 examine changes to 'plain'? [Ynesfdaq?] y
322 324
323 325 @@ -9,4 +9,4 @@
324 326 9
325 327 10
326 328 11
327 329 -7264f99c5f5ff3261504828afa4fb4d406c3af54
328 330 \ No newline at end of file
329 331 +7264f99c5f5ff3261504828afa4fb4d406c3af54
330 332 record change 1/2 to 'plain'? [Ynesfdaq?] y
331 333
332 334 diff --git a/plain2 b/plain2
333 335 new file mode 100644
334 336 examine changes to 'plain2'? [Ynesfdaq?] y
335 337
336 338
337 339 Modify beginning, trim end, record both, add another file to test
338 340 changes numbering
339 341
340 342 $ rm plain
341 343 $ for i in 2 2 3 4 5 6 7 8 9 10; do
342 344 > echo $i >> plain
343 345 > done
344 346 $ echo 2 >> plain2
345 347
346 348 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
347 349 > y
348 350 > y
349 351 > y
350 352 > y
351 353 > y
352 354 > EOF
353 355 diff --git a/plain b/plain
354 356 2 hunks, 3 lines changed
355 357 examine changes to 'plain'? [Ynesfdaq?] y
356 358
357 359 @@ -1,4 +1,4 @@
358 360 -1
359 361 +2
360 362 2
361 363 3
362 364 4
363 365 record change 1/3 to 'plain'? [Ynesfdaq?] y
364 366
365 367 @@ -8,5 +8,3 @@
366 368 8
367 369 9
368 370 10
369 371 -11
370 372 -7264f99c5f5ff3261504828afa4fb4d406c3af54
371 373 record change 2/3 to 'plain'? [Ynesfdaq?] y
372 374
373 375 diff --git a/plain2 b/plain2
374 376 1 hunks, 1 lines changed
375 377 examine changes to 'plain2'? [Ynesfdaq?] y
376 378
377 379 @@ -1,1 +1,2 @@
378 380 1
379 381 +2
380 382 record change 3/3 to 'plain2'? [Ynesfdaq?] y
381 383
382 384
383 385 $ hg tip -p
384 386 changeset: 11:21df83db12b8
385 387 tag: tip
386 388 user: test
387 389 date: Thu Jan 01 00:00:10 1970 +0000
388 390 summary: begin-and-end
389 391
390 392 diff -r ddb8b281c3ff -r 21df83db12b8 plain
391 393 --- a/plain Thu Jan 01 00:00:10 1970 +0000
392 394 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
393 395 @@ -1,4 +1,4 @@
394 396 -1
395 397 +2
396 398 2
397 399 3
398 400 4
399 401 @@ -8,5 +8,3 @@
400 402 8
401 403 9
402 404 10
403 405 -11
404 406 -7264f99c5f5ff3261504828afa4fb4d406c3af54
405 407 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
406 408 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
407 409 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
408 410 @@ -1,1 +1,2 @@
409 411 1
410 412 +2
411 413
412 414
413 415 Trim beginning, modify end
414 416
415 417 $ rm plain
416 418 > for i in 4 5 6 7 8 9 10.new; do
417 419 > echo $i >> plain
418 420 > done
419 421
420 422 Record end
421 423
422 424 $ hg record -d '11 0' -m end-only plain <<EOF
423 425 > y
424 426 > n
425 427 > y
426 428 > EOF
427 429 diff --git a/plain b/plain
428 430 2 hunks, 4 lines changed
429 431 examine changes to 'plain'? [Ynesfdaq?] y
430 432
431 433 @@ -1,9 +1,6 @@
432 434 -2
433 435 -2
434 436 -3
435 437 4
436 438 5
437 439 6
438 440 7
439 441 8
440 442 9
441 443 record change 1/2 to 'plain'? [Ynesfdaq?] n
442 444
443 445 @@ -4,7 +1,7 @@
444 446 4
445 447 5
446 448 6
447 449 7
448 450 8
449 451 9
450 452 -10
451 453 +10.new
452 454 record change 2/2 to 'plain'? [Ynesfdaq?] y
453 455
454 456
455 457 $ hg tip -p
456 458 changeset: 12:99337501826f
457 459 tag: tip
458 460 user: test
459 461 date: Thu Jan 01 00:00:11 1970 +0000
460 462 summary: end-only
461 463
462 464 diff -r 21df83db12b8 -r 99337501826f plain
463 465 --- a/plain Thu Jan 01 00:00:10 1970 +0000
464 466 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
465 467 @@ -7,4 +7,4 @@
466 468 7
467 469 8
468 470 9
469 471 -10
470 472 +10.new
471 473
472 474
473 475 Record beginning
474 476
475 477 $ hg record -d '12 0' -m begin-only plain <<EOF
476 478 > y
477 479 > y
478 480 > EOF
479 481 diff --git a/plain b/plain
480 482 1 hunks, 3 lines changed
481 483 examine changes to 'plain'? [Ynesfdaq?] y
482 484
483 485 @@ -1,6 +1,3 @@
484 486 -2
485 487 -2
486 488 -3
487 489 4
488 490 5
489 491 6
490 492 record this change to 'plain'? [Ynesfdaq?] y
491 493
492 494
493 495 $ hg tip -p
494 496 changeset: 13:bbd45465d540
495 497 tag: tip
496 498 user: test
497 499 date: Thu Jan 01 00:00:12 1970 +0000
498 500 summary: begin-only
499 501
500 502 diff -r 99337501826f -r bbd45465d540 plain
501 503 --- a/plain Thu Jan 01 00:00:11 1970 +0000
502 504 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
503 505 @@ -1,6 +1,3 @@
504 506 -2
505 507 -2
506 508 -3
507 509 4
508 510 5
509 511 6
510 512
511 513
512 514 Add to beginning, trim from end
513 515
514 516 $ rm plain
515 517 $ for i in 1 2 3 4 5 6 7 8 9; do
516 518 > echo $i >> plain
517 519 > done
518 520
519 521 Record end
520 522
521 523 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
522 524 > y
523 525 > n
524 526 > y
525 527 > EOF
526 528 diff --git a/plain b/plain
527 529 2 hunks, 4 lines changed
528 530 examine changes to 'plain'? [Ynesfdaq?] y
529 531
530 532 @@ -1,6 +1,9 @@
531 533 +1
532 534 +2
533 535 +3
534 536 4
535 537 5
536 538 6
537 539 7
538 540 8
539 541 9
540 542 record change 1/2 to 'plain'? [Ynesfdaq?] n
541 543
542 544 @@ -1,7 +4,6 @@
543 545 4
544 546 5
545 547 6
546 548 7
547 549 8
548 550 9
549 551 -10.new
550 552 record change 2/2 to 'plain'? [Ynesfdaq?] y
551 553
552 554
553 555 Add to beginning, middle, end
554 556
555 557 $ rm plain
556 558 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
557 559 > echo $i >> plain
558 560 > done
559 561
560 562 Record beginning, middle
561 563
562 564 $ hg record -d '14 0' -m middle-only plain <<EOF
563 565 > y
564 566 > y
565 567 > y
566 568 > n
567 569 > EOF
568 570 diff --git a/plain b/plain
569 571 3 hunks, 7 lines changed
570 572 examine changes to 'plain'? [Ynesfdaq?] y
571 573
572 574 @@ -1,2 +1,5 @@
573 575 +1
574 576 +2
575 577 +3
576 578 4
577 579 5
578 580 record change 1/3 to 'plain'? [Ynesfdaq?] y
579 581
580 582 @@ -1,6 +4,8 @@
581 583 4
582 584 5
583 585 +5.new
584 586 +5.reallynew
585 587 6
586 588 7
587 589 8
588 590 9
589 591 record change 2/3 to 'plain'? [Ynesfdaq?] y
590 592
591 593 @@ -3,4 +8,6 @@
592 594 6
593 595 7
594 596 8
595 597 9
596 598 +10
597 599 +11
598 600 record change 3/3 to 'plain'? [Ynesfdaq?] n
599 601
600 602
601 603 $ hg tip -p
602 604 changeset: 15:f34a7937ec33
603 605 tag: tip
604 606 user: test
605 607 date: Thu Jan 01 00:00:14 1970 +0000
606 608 summary: middle-only
607 609
608 610 diff -r 82c065d0b850 -r f34a7937ec33 plain
609 611 --- a/plain Thu Jan 01 00:00:13 1970 +0000
610 612 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
611 613 @@ -1,5 +1,10 @@
612 614 +1
613 615 +2
614 616 +3
615 617 4
616 618 5
617 619 +5.new
618 620 +5.reallynew
619 621 6
620 622 7
621 623 8
622 624
623 625
624 626 Record end
625 627
626 628 $ hg record -d '15 0' -m end-only plain <<EOF
627 629 > y
628 630 > y
629 631 > EOF
630 632 diff --git a/plain b/plain
631 633 1 hunks, 2 lines changed
632 634 examine changes to 'plain'? [Ynesfdaq?] y
633 635
634 636 @@ -9,3 +9,5 @@
635 637 7
636 638 8
637 639 9
638 640 +10
639 641 +11
640 642 record this change to 'plain'? [Ynesfdaq?] y
641 643
642 644
643 645 $ hg tip -p
644 646 changeset: 16:f9900b71a04c
645 647 tag: tip
646 648 user: test
647 649 date: Thu Jan 01 00:00:15 1970 +0000
648 650 summary: end-only
649 651
650 652 diff -r f34a7937ec33 -r f9900b71a04c plain
651 653 --- a/plain Thu Jan 01 00:00:14 1970 +0000
652 654 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
653 655 @@ -9,3 +9,5 @@
654 656 7
655 657 8
656 658 9
657 659 +10
658 660 +11
659 661
660 662
661 663 $ mkdir subdir
662 664 $ cd subdir
663 665 $ echo a > a
664 666 $ hg ci -d '16 0' -Amsubdir
665 667 adding subdir/a
666 668
667 669 $ echo a >> a
668 670 $ hg record -d '16 0' -m subdir-change a <<EOF
669 671 > y
670 672 > y
671 673 > EOF
672 674 diff --git a/subdir/a b/subdir/a
673 675 1 hunks, 1 lines changed
674 676 examine changes to 'subdir/a'? [Ynesfdaq?] y
675 677
676 678 @@ -1,1 +1,2 @@
677 679 a
678 680 +a
679 681 record this change to 'subdir/a'? [Ynesfdaq?] y
680 682
681 683
682 684 $ hg tip -p
683 685 changeset: 18:61be427a9deb
684 686 tag: tip
685 687 user: test
686 688 date: Thu Jan 01 00:00:16 1970 +0000
687 689 summary: subdir-change
688 690
689 691 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
690 692 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
691 693 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
692 694 @@ -1,1 +1,2 @@
693 695 a
694 696 +a
695 697
696 698
697 699 $ echo a > f1
698 700 $ echo b > f2
699 701 $ hg add f1 f2
700 702
701 703 $ hg ci -mz -d '17 0'
702 704
703 705 $ echo a >> f1
704 706 $ echo b >> f2
705 707
706 708 Help, quit
707 709
708 710 $ hg record <<EOF
709 711 > ?
710 712 > q
711 713 > EOF
712 714 diff --git a/subdir/f1 b/subdir/f1
713 715 1 hunks, 1 lines changed
714 716 examine changes to 'subdir/f1'? [Ynesfdaq?] ?
715 717
716 718 y - yes, record this change
717 719 n - no, skip this change
718 720 e - edit this change manually
719 721 s - skip remaining changes to this file
720 722 f - record remaining changes to this file
721 723 d - done, skip remaining changes and files
722 724 a - record all changes to all remaining files
723 725 q - quit, recording no changes
724 726 ? - ? (display help)
725 727 examine changes to 'subdir/f1'? [Ynesfdaq?] q
726 728
727 729 abort: user quit
728 730 [255]
729 731
730 732 Skip
731 733
732 734 $ hg record <<EOF
733 735 > s
734 736 > EOF
735 737 diff --git a/subdir/f1 b/subdir/f1
736 738 1 hunks, 1 lines changed
737 739 examine changes to 'subdir/f1'? [Ynesfdaq?] s
738 740
739 741 diff --git a/subdir/f2 b/subdir/f2
740 742 1 hunks, 1 lines changed
741 743 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
742 744 [255]
743 745
744 746 No
745 747
746 748 $ hg record <<EOF
747 749 > n
748 750 > EOF
749 751 diff --git a/subdir/f1 b/subdir/f1
750 752 1 hunks, 1 lines changed
751 753 examine changes to 'subdir/f1'? [Ynesfdaq?] n
752 754
753 755 diff --git a/subdir/f2 b/subdir/f2
754 756 1 hunks, 1 lines changed
755 757 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
756 758 [255]
757 759
758 760 f, quit
759 761
760 762 $ hg record <<EOF
761 763 > f
762 764 > q
763 765 > EOF
764 766 diff --git a/subdir/f1 b/subdir/f1
765 767 1 hunks, 1 lines changed
766 768 examine changes to 'subdir/f1'? [Ynesfdaq?] f
767 769
768 770 diff --git a/subdir/f2 b/subdir/f2
769 771 1 hunks, 1 lines changed
770 772 examine changes to 'subdir/f2'? [Ynesfdaq?] q
771 773
772 774 abort: user quit
773 775 [255]
774 776
775 777 s, all
776 778
777 779 $ hg record -d '18 0' -mx <<EOF
778 780 > s
779 781 > a
780 782 > EOF
781 783 diff --git a/subdir/f1 b/subdir/f1
782 784 1 hunks, 1 lines changed
783 785 examine changes to 'subdir/f1'? [Ynesfdaq?] s
784 786
785 787 diff --git a/subdir/f2 b/subdir/f2
786 788 1 hunks, 1 lines changed
787 789 examine changes to 'subdir/f2'? [Ynesfdaq?] a
788 790
789 791
790 792 $ hg tip -p
791 793 changeset: 20:b3df3dda369a
792 794 tag: tip
793 795 user: test
794 796 date: Thu Jan 01 00:00:18 1970 +0000
795 797 summary: x
796 798
797 799 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
798 800 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
799 801 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
800 802 @@ -1,1 +1,2 @@
801 803 b
802 804 +b
803 805
804 806
805 807 f
806 808
807 809 $ hg record -d '19 0' -my <<EOF
808 810 > f
809 811 > EOF
810 812 diff --git a/subdir/f1 b/subdir/f1
811 813 1 hunks, 1 lines changed
812 814 examine changes to 'subdir/f1'? [Ynesfdaq?] f
813 815
814 816
815 817 $ hg tip -p
816 818 changeset: 21:38ec577f126b
817 819 tag: tip
818 820 user: test
819 821 date: Thu Jan 01 00:00:19 1970 +0000
820 822 summary: y
821 823
822 824 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
823 825 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
824 826 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
825 827 @@ -1,1 +1,2 @@
826 828 a
827 829 +a
828 830
829 831
830 832 #if execbit
831 833
832 834 Preserve chmod +x
833 835
834 836 $ chmod +x f1
835 837 $ echo a >> f1
836 838 $ hg record -d '20 0' -mz <<EOF
837 839 > y
838 840 > y
839 841 > y
840 842 > EOF
841 843 diff --git a/subdir/f1 b/subdir/f1
842 844 old mode 100644
843 845 new mode 100755
844 846 1 hunks, 1 lines changed
845 847 examine changes to 'subdir/f1'? [Ynesfdaq?] y
846 848
847 849 @@ -1,2 +1,3 @@
848 850 a
849 851 a
850 852 +a
851 853 record this change to 'subdir/f1'? [Ynesfdaq?] y
852 854
853 855
854 856 $ hg tip --config diff.git=True -p
855 857 changeset: 22:3261adceb075
856 858 tag: tip
857 859 user: test
858 860 date: Thu Jan 01 00:00:20 1970 +0000
859 861 summary: z
860 862
861 863 diff --git a/subdir/f1 b/subdir/f1
862 864 old mode 100644
863 865 new mode 100755
864 866 --- a/subdir/f1
865 867 +++ b/subdir/f1
866 868 @@ -1,2 +1,3 @@
867 869 a
868 870 a
869 871 +a
870 872
871 873
872 874 Preserve execute permission on original
873 875
874 876 $ echo b >> f1
875 877 $ hg record -d '21 0' -maa <<EOF
876 878 > y
877 879 > y
878 880 > y
879 881 > EOF
880 882 diff --git a/subdir/f1 b/subdir/f1
881 883 1 hunks, 1 lines changed
882 884 examine changes to 'subdir/f1'? [Ynesfdaq?] y
883 885
884 886 @@ -1,3 +1,4 @@
885 887 a
886 888 a
887 889 a
888 890 +b
889 891 record this change to 'subdir/f1'? [Ynesfdaq?] y
890 892
891 893
892 894 $ hg tip --config diff.git=True -p
893 895 changeset: 23:b429867550db
894 896 tag: tip
895 897 user: test
896 898 date: Thu Jan 01 00:00:21 1970 +0000
897 899 summary: aa
898 900
899 901 diff --git a/subdir/f1 b/subdir/f1
900 902 --- a/subdir/f1
901 903 +++ b/subdir/f1
902 904 @@ -1,3 +1,4 @@
903 905 a
904 906 a
905 907 a
906 908 +b
907 909
908 910
909 911 Preserve chmod -x
910 912
911 913 $ chmod -x f1
912 914 $ echo c >> f1
913 915 $ hg record -d '22 0' -mab <<EOF
914 916 > y
915 917 > y
916 918 > y
917 919 > EOF
918 920 diff --git a/subdir/f1 b/subdir/f1
919 921 old mode 100755
920 922 new mode 100644
921 923 1 hunks, 1 lines changed
922 924 examine changes to 'subdir/f1'? [Ynesfdaq?] y
923 925
924 926 @@ -2,3 +2,4 @@
925 927 a
926 928 a
927 929 b
928 930 +c
929 931 record this change to 'subdir/f1'? [Ynesfdaq?] y
930 932
931 933
932 934 $ hg tip --config diff.git=True -p
933 935 changeset: 24:0b082130c20a
934 936 tag: tip
935 937 user: test
936 938 date: Thu Jan 01 00:00:22 1970 +0000
937 939 summary: ab
938 940
939 941 diff --git a/subdir/f1 b/subdir/f1
940 942 old mode 100755
941 943 new mode 100644
942 944 --- a/subdir/f1
943 945 +++ b/subdir/f1
944 946 @@ -2,3 +2,4 @@
945 947 a
946 948 a
947 949 b
948 950 +c
949 951
950 952
951 953 #else
952 954
953 955 Slightly bogus tests to get almost same repo structure as when x bit is used
954 956 - but with different hashes.
955 957
956 958 Mock "Preserve chmod +x"
957 959
958 960 $ echo a >> f1
959 961 $ hg record -d '20 0' -mz <<EOF
960 962 > y
961 963 > y
962 964 > y
963 965 > EOF
964 966 diff --git a/subdir/f1 b/subdir/f1
965 967 1 hunks, 1 lines changed
966 968 examine changes to 'subdir/f1'? [Ynesfdaq?] y
967 969
968 970 @@ -1,2 +1,3 @@
969 971 a
970 972 a
971 973 +a
972 974 record this change to 'subdir/f1'? [Ynesfdaq?] y
973 975
974 976
975 977 $ hg tip --config diff.git=True -p
976 978 changeset: 22:0d463bd428f5
977 979 tag: tip
978 980 user: test
979 981 date: Thu Jan 01 00:00:20 1970 +0000
980 982 summary: z
981 983
982 984 diff --git a/subdir/f1 b/subdir/f1
983 985 --- a/subdir/f1
984 986 +++ b/subdir/f1
985 987 @@ -1,2 +1,3 @@
986 988 a
987 989 a
988 990 +a
989 991
990 992
991 993 Mock "Preserve execute permission on original"
992 994
993 995 $ echo b >> f1
994 996 $ hg record -d '21 0' -maa <<EOF
995 997 > y
996 998 > y
997 999 > y
998 1000 > EOF
999 1001 diff --git a/subdir/f1 b/subdir/f1
1000 1002 1 hunks, 1 lines changed
1001 1003 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1002 1004
1003 1005 @@ -1,3 +1,4 @@
1004 1006 a
1005 1007 a
1006 1008 a
1007 1009 +b
1008 1010 record this change to 'subdir/f1'? [Ynesfdaq?] y
1009 1011
1010 1012
1011 1013 $ hg tip --config diff.git=True -p
1012 1014 changeset: 23:0eab41a3e524
1013 1015 tag: tip
1014 1016 user: test
1015 1017 date: Thu Jan 01 00:00:21 1970 +0000
1016 1018 summary: aa
1017 1019
1018 1020 diff --git a/subdir/f1 b/subdir/f1
1019 1021 --- a/subdir/f1
1020 1022 +++ b/subdir/f1
1021 1023 @@ -1,3 +1,4 @@
1022 1024 a
1023 1025 a
1024 1026 a
1025 1027 +b
1026 1028
1027 1029
1028 1030 Mock "Preserve chmod -x"
1029 1031
1030 1032 $ chmod -x f1
1031 1033 $ echo c >> f1
1032 1034 $ hg record -d '22 0' -mab <<EOF
1033 1035 > y
1034 1036 > y
1035 1037 > y
1036 1038 > EOF
1037 1039 diff --git a/subdir/f1 b/subdir/f1
1038 1040 1 hunks, 1 lines changed
1039 1041 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1040 1042
1041 1043 @@ -2,3 +2,4 @@
1042 1044 a
1043 1045 a
1044 1046 b
1045 1047 +c
1046 1048 record this change to 'subdir/f1'? [Ynesfdaq?] y
1047 1049
1048 1050
1049 1051 $ hg tip --config diff.git=True -p
1050 1052 changeset: 24:f4f718f27b7c
1051 1053 tag: tip
1052 1054 user: test
1053 1055 date: Thu Jan 01 00:00:22 1970 +0000
1054 1056 summary: ab
1055 1057
1056 1058 diff --git a/subdir/f1 b/subdir/f1
1057 1059 --- a/subdir/f1
1058 1060 +++ b/subdir/f1
1059 1061 @@ -2,3 +2,4 @@
1060 1062 a
1061 1063 a
1062 1064 b
1063 1065 +c
1064 1066
1065 1067
1066 1068 #endif
1067 1069
1068 1070 $ cd ..
1069 1071
1070 1072
1071 1073 Abort early when a merge is in progress
1072 1074
1073 1075 $ hg up 4
1074 1076 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
1075 1077
1076 1078 $ touch iwillmergethat
1077 1079 $ hg add iwillmergethat
1078 1080
1079 1081 $ hg branch thatbranch
1080 1082 marked working directory as branch thatbranch
1081 1083 (branches are permanent and global, did you want a bookmark?)
1082 1084
1083 1085 $ hg ci -m'new head'
1084 1086
1085 1087 $ hg up default
1086 1088 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
1087 1089
1088 1090 $ hg merge thatbranch
1089 1091 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1090 1092 (branch merge, don't forget to commit)
1091 1093
1092 1094 $ hg record -m'will abort'
1093 1095 abort: cannot partially commit a merge (use "hg commit" instead)
1094 1096 [255]
1095 1097
1096 1098 $ hg up -C
1097 1099 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1098 1100
1099 1101 Editing patch (and ignoring trailing text)
1100 1102
1101 1103 $ cat > editor.sh << '__EOF__'
1102 1104 > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\
1103 1105 > trailing\nditto' "$1" > tmp
1104 1106 > mv tmp "$1"
1105 1107 > __EOF__
1106 1108 $ cat > editedfile << '__EOF__'
1107 1109 > This is the first line
1108 1110 > This is the second line
1109 1111 > This is the third line
1110 1112 > __EOF__
1111 1113 $ hg add editedfile
1112 1114 $ hg commit -medit-patch-1
1113 1115 $ cat > editedfile << '__EOF__'
1114 1116 > This line has changed
1115 1117 > This change will be committed
1116 1118 > This is the third line
1117 1119 > __EOF__
1118 1120 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-2 <<EOF
1119 1121 > y
1120 1122 > e
1121 1123 > EOF
1122 1124 diff --git a/editedfile b/editedfile
1123 1125 1 hunks, 2 lines changed
1124 1126 examine changes to 'editedfile'? [Ynesfdaq?] y
1125 1127
1126 1128 @@ -1,3 +1,3 @@
1127 1129 -This is the first line
1128 1130 -This is the second line
1129 1131 +This line has changed
1130 1132 +This change will be committed
1131 1133 This is the third line
1132 1134 record this change to 'editedfile'? [Ynesfdaq?] e
1133 1135
1134 1136 $ cat editedfile
1135 1137 This line has changed
1136 1138 This change will be committed
1137 1139 This is the third line
1138 1140 $ hg cat -r tip editedfile
1139 1141 This is the first line
1140 1142 This change will be committed
1141 1143 This is the third line
1142 1144 $ hg revert editedfile
1143 1145
1144 1146 Trying to edit patch for whole file
1145 1147
1146 1148 $ echo "This is the fourth line" >> editedfile
1147 1149 $ hg record <<EOF
1148 1150 > e
1149 1151 > q
1150 1152 > EOF
1151 1153 diff --git a/editedfile b/editedfile
1152 1154 1 hunks, 1 lines changed
1153 1155 examine changes to 'editedfile'? [Ynesfdaq?] e
1154 1156
1155 1157 cannot edit patch for whole file
1156 1158 examine changes to 'editedfile'? [Ynesfdaq?] q
1157 1159
1158 1160 abort: user quit
1159 1161 [255]
1160 1162 $ hg revert editedfile
1161 1163
1162 1164 Removing changes from patch
1163 1165
1164 1166 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1165 1167 $ mv tmp editedfile
1166 1168 $ echo "This line has been added" >> editedfile
1167 1169 $ cat > editor.sh << '__EOF__'
1168 1170 > sed -e 's/^[-+]/ /' "$1" > tmp
1169 1171 > mv tmp "$1"
1170 1172 > __EOF__
1171 1173 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1172 1174 > y
1173 1175 > e
1174 1176 > EOF
1175 1177 diff --git a/editedfile b/editedfile
1176 1178 1 hunks, 3 lines changed
1177 1179 examine changes to 'editedfile'? [Ynesfdaq?] y
1178 1180
1179 1181 @@ -1,3 +1,3 @@
1180 1182 -This is the first line
1181 1183 -This change will be committed
1182 1184 -This is the third line
1183 1185 +This change will not be committed
1184 1186 +This is the second line
1185 1187 +This line has been added
1186 1188 record this change to 'editedfile'? [Ynesfdaq?] e
1187 1189
1188 1190 no changes to record
1189 1191 $ cat editedfile
1190 1192 This change will not be committed
1191 1193 This is the second line
1192 1194 This line has been added
1193 1195 $ hg cat -r tip editedfile
1194 1196 This is the first line
1195 1197 This change will be committed
1196 1198 This is the third line
1197 1199 $ hg revert editedfile
1198 1200
1199 1201 Invalid patch
1200 1202
1201 1203 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1202 1204 $ mv tmp editedfile
1203 1205 $ echo "This line has been added" >> editedfile
1204 1206 $ cat > editor.sh << '__EOF__'
1205 1207 > sed s/This/That/ "$1" > tmp
1206 1208 > mv tmp "$1"
1207 1209 > __EOF__
1208 1210 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1209 1211 > y
1210 1212 > e
1211 1213 > EOF
1212 1214 diff --git a/editedfile b/editedfile
1213 1215 1 hunks, 3 lines changed
1214 1216 examine changes to 'editedfile'? [Ynesfdaq?] y
1215 1217
1216 1218 @@ -1,3 +1,3 @@
1217 1219 -This is the first line
1218 1220 -This change will be committed
1219 1221 -This is the third line
1220 1222 +This change will not be committed
1221 1223 +This is the second line
1222 1224 +This line has been added
1223 1225 record this change to 'editedfile'? [Ynesfdaq?] e
1224 1226
1225 1227 patching file editedfile
1226 1228 Hunk #1 FAILED at 0
1227 1229 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej
1228 1230 abort: patch failed to apply
1229 1231 [255]
1230 1232 $ cat editedfile
1231 1233 This change will not be committed
1232 1234 This is the second line
1233 1235 This line has been added
1234 1236 $ hg cat -r tip editedfile
1235 1237 This is the first line
1236 1238 This change will be committed
1237 1239 This is the third line
1238 1240 $ cat editedfile.rej
1239 1241 --- editedfile
1240 1242 +++ editedfile
1241 1243 @@ -1,3 +1,3 @@
1242 1244 -That is the first line
1243 1245 -That change will be committed
1244 1246 -That is the third line
1245 1247 +That change will not be committed
1246 1248 +That is the second line
1247 1249 +That line has been added
1248 1250
1249 1251 Malformed patch - error handling
1250 1252
1251 1253 $ cat > editor.sh << '__EOF__'
1252 1254 > sed -e '/^@/p' "$1" > tmp
1253 1255 > mv tmp "$1"
1254 1256 > __EOF__
1255 1257 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1256 1258 > y
1257 1259 > e
1258 1260 > EOF
1259 1261 diff --git a/editedfile b/editedfile
1260 1262 1 hunks, 3 lines changed
1261 1263 examine changes to 'editedfile'? [Ynesfdaq?] y
1262 1264
1263 1265 @@ -1,3 +1,3 @@
1264 1266 -This is the first line
1265 1267 -This change will be committed
1266 1268 -This is the third line
1267 1269 +This change will not be committed
1268 1270 +This is the second line
1269 1271 +This line has been added
1270 1272 record this change to 'editedfile'? [Ynesfdaq?] e
1271 1273
1272 1274 abort: error parsing patch: unhandled transition: range -> range
1273 1275 [255]
1274 1276
1275 1277 random text in random positions is still an error
1276 1278
1277 1279 $ cat > editor.sh << '__EOF__'
1278 1280 > sed -e '/^@/i\
1279 1281 > other' "$1" > tmp
1280 1282 > mv tmp "$1"
1281 1283 > __EOF__
1282 1284 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1283 1285 > y
1284 1286 > e
1285 1287 > EOF
1286 1288 diff --git a/editedfile b/editedfile
1287 1289 1 hunks, 3 lines changed
1288 1290 examine changes to 'editedfile'? [Ynesfdaq?] y
1289 1291
1290 1292 @@ -1,3 +1,3 @@
1291 1293 -This is the first line
1292 1294 -This change will be committed
1293 1295 -This is the third line
1294 1296 +This change will not be committed
1295 1297 +This is the second line
1296 1298 +This line has been added
1297 1299 record this change to 'editedfile'? [Ynesfdaq?] e
1298 1300
1299 1301 abort: error parsing patch: unhandled transition: file -> other
1300 1302 [255]
1301 1303
1302 1304 $ hg up -C
1303 1305 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1304 1306
1305 1307 With win32text
1306 1308
1307 1309 $ echo '[extensions]' >> .hg/hgrc
1308 1310 $ echo 'win32text = ' >> .hg/hgrc
1309 1311 $ echo '[decode]' >> .hg/hgrc
1310 1312 $ echo '** = cleverdecode:' >> .hg/hgrc
1311 1313 $ echo '[encode]' >> .hg/hgrc
1312 1314 $ echo '** = cleverencode:' >> .hg/hgrc
1313 1315 $ echo '[patch]' >> .hg/hgrc
1314 1316 $ echo 'eol = crlf' >> .hg/hgrc
1315 1317
1316 1318 Ignore win32text deprecation warning for now:
1317 1319
1318 1320 $ echo '[win32text]' >> .hg/hgrc
1319 1321 $ echo 'warn = no' >> .hg/hgrc
1320 1322
1321 1323 $ echo d >> subdir/f1
1322 1324 $ hg record -d '24 0' -mw1 <<EOF
1323 1325 > y
1324 1326 > y
1325 1327 > EOF
1326 1328 diff --git a/subdir/f1 b/subdir/f1
1327 1329 1 hunks, 1 lines changed
1328 1330 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1329 1331
1330 1332 @@ -3,3 +3,4 @@
1331 1333 a
1332 1334 b
1333 1335 c
1334 1336 +d
1335 1337 record this change to 'subdir/f1'? [Ynesfdaq?] y
1336 1338
1337 1339
1338 1340 $ hg tip -p
1339 1341 changeset: 28:* (glob)
1340 1342 tag: tip
1341 1343 user: test
1342 1344 date: Thu Jan 01 00:00:24 1970 +0000
1343 1345 summary: w1
1344 1346
1345 1347 diff -r ???????????? -r ???????????? subdir/f1 (glob)
1346 1348 --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
1347 1349 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000
1348 1350 @@ -3,3 +3,4 @@
1349 1351 a
1350 1352 b
1351 1353 c
1352 1354 +d
1353 1355
1354 1356 Test --user when ui.username not set
1355 1357 $ unset HGUSER
1356 1358 $ echo e >> subdir/f1
1357 1359 $ hg record --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF
1358 1360 > y
1359 1361 > y
1360 1362 > EOF
1361 1363 diff --git a/subdir/f1 b/subdir/f1
1362 1364 1 hunks, 1 lines changed
1363 1365 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1364 1366
1365 1367 @@ -4,3 +4,4 @@
1366 1368 b
1367 1369 c
1368 1370 d
1369 1371 +e
1370 1372 record this change to 'subdir/f1'? [Ynesfdaq?] y
1371 1373
1372 1374 $ hg log --template '{author}\n' -l 1
1373 1375 xyz
1374 1376 $ HGUSER="test"
1375 1377 $ export HGUSER
1376 1378
1377 1379 $ cd ..
@@ -1,732 +1,734 b''
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "shelve=" >> $HGRCPATH
4 $ echo "[defaults]" >> $HGRCPATH
5 $ echo "diff = --nodates --git" >> $HGRCPATH
6 $ echo "qnew = --date '0 0'" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > mq =
4 > shelve =
5 > [defaults]
6 > diff = --nodates --git
7 > qnew = --date '0 0'
8 > EOF
7 9
8 10 $ hg init repo
9 11 $ cd repo
10 12 $ mkdir a b
11 13 $ echo a > a/a
12 14 $ echo b > b/b
13 15 $ echo c > c
14 16 $ echo d > d
15 17 $ echo x > x
16 18 $ hg addremove -q
17 19
18 20 shelving in an empty repo should be possible
19 21 (this tests also that editor is not invoked, if '--edit' is not
20 22 specified)
21 23
22 24 $ HGEDITOR=cat hg shelve
23 25 shelved as default
24 26 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
25 27
26 28 $ hg unshelve
27 29 unshelving change 'default'
28 30
29 31 $ hg commit -q -m 'initial commit'
30 32
31 33 $ hg shelve
32 34 nothing changed
33 35 [1]
34 36
35 37 create an mq patch - shelving should work fine with a patch applied
36 38
37 39 $ echo n > n
38 40 $ hg add n
39 41 $ hg commit n -m second
40 42 $ hg qnew second.patch
41 43
42 44 shelve a change that we will delete later
43 45
44 46 $ echo a >> a/a
45 47 $ hg shelve
46 48 shelved as default
47 49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 50
49 51 set up some more complex changes to shelve
50 52
51 53 $ echo a >> a/a
52 54 $ hg mv b b.rename
53 55 moving b/b to b.rename/b (glob)
54 56 $ hg cp c c.copy
55 57 $ hg status -C
56 58 M a/a
57 59 A b.rename/b
58 60 b/b
59 61 A c.copy
60 62 c
61 63 R b/b
62 64
63 65 prevent some foot-shooting
64 66
65 67 $ hg shelve -n foo/bar
66 68 abort: shelved change names may not contain slashes
67 69 [255]
68 70 $ hg shelve -n .baz
69 71 abort: shelved change names may not start with '.'
70 72 [255]
71 73
72 74 the common case - no options or filenames
73 75
74 76 $ hg shelve
75 77 shelved as default-01
76 78 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
77 79 $ hg status -C
78 80
79 81 ensure that our shelved changes exist
80 82
81 83 $ hg shelve -l
82 84 default-01 (*) changes to '[mq]: second.patch' (glob)
83 85 default (*) changes to '[mq]: second.patch' (glob)
84 86
85 87 $ hg shelve -l -p default
86 88 default (*) changes to '[mq]: second.patch' (glob)
87 89
88 90 diff --git a/a/a b/a/a
89 91 --- a/a/a
90 92 +++ b/a/a
91 93 @@ -1,1 +1,2 @@
92 94 a
93 95 +a
94 96
95 97 $ hg shelve --list --addremove
96 98 abort: options '--list' and '--addremove' may not be used together
97 99 [255]
98 100
99 101 delete our older shelved change
100 102
101 103 $ hg shelve -d default
102 104 $ hg qfinish -a -q
103 105
104 106 local edits should not prevent a shelved change from applying
105 107
106 108 $ printf "z\na\n" > a/a
107 109 $ hg unshelve --keep
108 110 unshelving change 'default-01'
109 111 temporarily committing pending changes (restore with 'hg unshelve --abort')
110 112 rebasing shelved changes
111 113 merging a/a
112 114
113 115 $ hg revert --all -q
114 116 $ rm a/a.orig b.rename/b c.copy
115 117
116 118 apply it and make sure our state is as expected
117 119
118 120 $ hg unshelve
119 121 unshelving change 'default-01'
120 122 $ hg status -C
121 123 M a/a
122 124 A b.rename/b
123 125 b/b
124 126 A c.copy
125 127 c
126 128 R b/b
127 129 $ hg shelve -l
128 130
129 131 $ hg unshelve
130 132 abort: no shelved changes to apply!
131 133 [255]
132 134 $ hg unshelve foo
133 135 abort: shelved change 'foo' not found
134 136 [255]
135 137
136 138 named shelves, specific filenames, and "commit messages" should all work
137 139 (this tests also that editor is invoked, if '--edit' is specified)
138 140
139 141 $ hg status -C
140 142 M a/a
141 143 A b.rename/b
142 144 b/b
143 145 A c.copy
144 146 c
145 147 R b/b
146 148 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
147 149 wat
148 150
149 151
150 152 HG: Enter commit message. Lines beginning with 'HG:' are removed.
151 153 HG: Leave message empty to abort commit.
152 154 HG: --
153 155 HG: user: shelve@localhost
154 156 HG: branch 'default'
155 157 HG: changed a/a
156 158
157 159 expect "a" to no longer be present, but status otherwise unchanged
158 160
159 161 $ hg status -C
160 162 A b.rename/b
161 163 b/b
162 164 A c.copy
163 165 c
164 166 R b/b
165 167 $ hg shelve -l --stat
166 168 wibble (*) wat (glob)
167 169 a/a | 1 +
168 170 1 files changed, 1 insertions(+), 0 deletions(-)
169 171
170 172 and now "a/a" should reappear
171 173
172 174 $ cd a
173 175 $ hg unshelve -q wibble
174 176 $ cd ..
175 177 $ hg status -C
176 178 M a/a
177 179 A b.rename/b
178 180 b/b
179 181 A c.copy
180 182 c
181 183 R b/b
182 184
183 185 cause unshelving to result in a merge with 'a' conflicting
184 186
185 187 $ hg shelve -q
186 188 $ echo c>>a/a
187 189 $ hg commit -m second
188 190 $ hg tip --template '{files}\n'
189 191 a/a
190 192
191 193 add an unrelated change that should be preserved
192 194
193 195 $ mkdir foo
194 196 $ echo foo > foo/foo
195 197 $ hg add foo/foo
196 198
197 199 force a conflicted merge to occur
198 200
199 201 $ hg unshelve
200 202 unshelving change 'default'
201 203 temporarily committing pending changes (restore with 'hg unshelve --abort')
202 204 rebasing shelved changes
203 205 merging a/a
204 206 warning: conflicts during merge.
205 207 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
206 208 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
207 209 [1]
208 210
209 211 ensure that we have a merge with unresolved conflicts
210 212
211 213 $ hg heads -q --template '{rev}\n'
212 214 5
213 215 4
214 216 $ hg parents -q --template '{rev}\n'
215 217 4
216 218 5
217 219 $ hg status
218 220 M a/a
219 221 M b.rename/b
220 222 M c.copy
221 223 R b/b
222 224 ? a/a.orig
223 225 $ hg diff
224 226 diff --git a/a/a b/a/a
225 227 --- a/a/a
226 228 +++ b/a/a
227 229 @@ -1,2 +1,6 @@
228 230 a
229 231 +<<<<<<< dest: * - shelve: pending changes temporary commit (glob)
230 232 c
231 233 +=======
232 234 +a
233 235 +>>>>>>> source: 4702e8911fe0 - shelve: changes to '[mq]: second.patch'
234 236 diff --git a/b/b b/b.rename/b
235 237 rename from b/b
236 238 rename to b.rename/b
237 239 diff --git a/b/b b/b/b
238 240 deleted file mode 100644
239 241 --- a/b/b
240 242 +++ /dev/null
241 243 @@ -1,1 +0,0 @@
242 244 -b
243 245 diff --git a/c b/c.copy
244 246 copy from c
245 247 copy to c.copy
246 248 $ hg resolve -l
247 249 U a/a
248 250
249 251 $ hg shelve
250 252 abort: unshelve already in progress
251 253 (use 'hg unshelve --continue' or 'hg unshelve --abort')
252 254 [255]
253 255
254 256 abort the unshelve and be happy
255 257
256 258 $ hg status
257 259 M a/a
258 260 M b.rename/b
259 261 M c.copy
260 262 R b/b
261 263 ? a/a.orig
262 264 $ hg unshelve -a
263 265 rebase aborted
264 266 unshelve of 'default' aborted
265 267 $ hg heads -q
266 268 3:2e69b451d1ea
267 269 $ hg parents
268 270 changeset: 3:2e69b451d1ea
269 271 tag: tip
270 272 user: test
271 273 date: Thu Jan 01 00:00:00 1970 +0000
272 274 summary: second
273 275
274 276 $ hg resolve -l
275 277 $ hg status
276 278 A foo/foo
277 279 ? a/a.orig
278 280
279 281 try to continue with no unshelve underway
280 282
281 283 $ hg unshelve -c
282 284 abort: no unshelve operation underway
283 285 [255]
284 286 $ hg status
285 287 A foo/foo
286 288 ? a/a.orig
287 289
288 290 redo the unshelve to get a conflict
289 291
290 292 $ hg unshelve -q
291 293 warning: conflicts during merge.
292 294 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
293 295 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
294 296 [1]
295 297
296 298 attempt to continue
297 299
298 300 $ hg unshelve -c
299 301 abort: unresolved conflicts, can't continue
300 302 (see 'hg resolve', then 'hg unshelve --continue')
301 303 [255]
302 304
303 305 $ hg revert -r . a/a
304 306 $ hg resolve -m a/a
305 307 (no more unresolved files)
306 308
307 309 $ hg commit -m 'commit while unshelve in progress'
308 310 abort: unshelve already in progress
309 311 (use 'hg unshelve --continue' or 'hg unshelve --abort')
310 312 [255]
311 313
312 314 $ hg unshelve -c
313 315 unshelve of 'default' complete
314 316
315 317 ensure the repo is as we hope
316 318
317 319 $ hg parents
318 320 changeset: 3:2e69b451d1ea
319 321 tag: tip
320 322 user: test
321 323 date: Thu Jan 01 00:00:00 1970 +0000
322 324 summary: second
323 325
324 326 $ hg heads -q
325 327 3:2e69b451d1ea
326 328
327 329 $ hg status -C
328 330 A b.rename/b
329 331 b/b
330 332 A c.copy
331 333 c
332 334 A foo/foo
333 335 R b/b
334 336 ? a/a.orig
335 337
336 338 there should be no shelves left
337 339
338 340 $ hg shelve -l
339 341
340 342 #if execbit
341 343
342 344 ensure that metadata-only changes are shelved
343 345
344 346 $ chmod +x a/a
345 347 $ hg shelve -q -n execbit a/a
346 348 $ hg status a/a
347 349 $ hg unshelve -q execbit
348 350 $ hg status a/a
349 351 M a/a
350 352 $ hg revert a/a
351 353
352 354 #endif
353 355
354 356 #if symlink
355 357
356 358 $ rm a/a
357 359 $ ln -s foo a/a
358 360 $ hg shelve -q -n symlink a/a
359 361 $ hg status a/a
360 362 $ hg unshelve -q symlink
361 363 $ hg status a/a
362 364 M a/a
363 365 $ hg revert a/a
364 366
365 367 #endif
366 368
367 369 set up another conflict between a commit and a shelved change
368 370
369 371 $ hg revert -q -C -a
370 372 $ rm a/a.orig b.rename/b c.copy
371 373 $ echo a >> a/a
372 374 $ hg shelve -q
373 375 $ echo x >> a/a
374 376 $ hg ci -m 'create conflict'
375 377 $ hg add foo/foo
376 378
377 379 if we resolve a conflict while unshelving, the unshelve should succeed
378 380
379 381 $ HGMERGE=true hg unshelve
380 382 unshelving change 'default'
381 383 temporarily committing pending changes (restore with 'hg unshelve --abort')
382 384 rebasing shelved changes
383 385 merging a/a
384 386 $ hg parents -q
385 387 4:33f7f61e6c5e
386 388 $ hg shelve -l
387 389 $ hg status
388 390 A foo/foo
389 391 $ cat a/a
390 392 a
391 393 c
392 394 x
393 395
394 396 test keep and cleanup
395 397
396 398 $ hg shelve
397 399 shelved as default
398 400 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
399 401 $ hg shelve --list
400 402 default (*) changes to 'create conflict' (glob)
401 403 $ hg unshelve --keep
402 404 unshelving change 'default'
403 405 $ hg shelve --list
404 406 default (*) changes to 'create conflict' (glob)
405 407 $ hg shelve --cleanup
406 408 $ hg shelve --list
407 409
408 410 $ hg shelve --cleanup --delete
409 411 abort: options '--cleanup' and '--delete' may not be used together
410 412 [255]
411 413 $ hg shelve --cleanup --patch
412 414 abort: options '--cleanup' and '--patch' may not be used together
413 415 [255]
414 416 $ hg shelve --cleanup --message MESSAGE
415 417 abort: options '--cleanup' and '--message' may not be used together
416 418 [255]
417 419
418 420 test bookmarks
419 421
420 422 $ hg bookmark test
421 423 $ hg bookmark
422 424 * test 4:33f7f61e6c5e
423 425 $ hg shelve
424 426 shelved as test
425 427 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
426 428 $ hg bookmark
427 429 * test 4:33f7f61e6c5e
428 430 $ hg unshelve
429 431 unshelving change 'test'
430 432 $ hg bookmark
431 433 * test 4:33f7f61e6c5e
432 434
433 435 shelve should still work even if mq is disabled
434 436
435 437 $ hg --config extensions.mq=! shelve
436 438 shelved as test
437 439 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
438 440 $ hg --config extensions.mq=! shelve --list
439 441 test (*) changes to 'create conflict' (glob)
440 442 $ hg --config extensions.mq=! unshelve
441 443 unshelving change 'test'
442 444
443 445 shelve should leave dirstate clean (issue4055)
444 446
445 447 $ cd ..
446 448 $ hg init shelverebase
447 449 $ cd shelverebase
448 450 $ printf 'x\ny\n' > x
449 451 $ echo z > z
450 452 $ hg commit -Aqm xy
451 453 $ echo z >> x
452 454 $ hg commit -Aqm z
453 455 $ hg up 0
454 456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
455 457 $ printf 'a\nx\ny\nz\n' > x
456 458 $ hg commit -Aqm xyz
457 459 $ echo c >> z
458 460 $ hg shelve
459 461 shelved as default
460 462 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 463 $ hg rebase -d 1 --config extensions.rebase=
462 464 merging x
463 465 saved backup bundle to $TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-backup.hg (glob)
464 466 $ hg unshelve
465 467 unshelving change 'default'
466 468 rebasing shelved changes
467 469 $ hg status
468 470 M z
469 471
470 472 $ cd ..
471 473
472 474 shelve should only unshelve pending changes (issue4068)
473 475
474 476 $ hg init onlypendingchanges
475 477 $ cd onlypendingchanges
476 478 $ touch a
477 479 $ hg ci -Aqm a
478 480 $ touch b
479 481 $ hg ci -Aqm b
480 482 $ hg up -q 0
481 483 $ touch c
482 484 $ hg ci -Aqm c
483 485
484 486 $ touch d
485 487 $ hg add d
486 488 $ hg shelve
487 489 shelved as default
488 490 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
489 491 $ hg up -q 1
490 492 $ hg unshelve
491 493 unshelving change 'default'
492 494 rebasing shelved changes
493 495 $ hg status
494 496 A d
495 497
496 498 unshelve should work on an ancestor of the original commit
497 499
498 500 $ hg shelve
499 501 shelved as default
500 502 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
501 503 $ hg up 0
502 504 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
503 505 $ hg unshelve
504 506 unshelving change 'default'
505 507 rebasing shelved changes
506 508 $ hg status
507 509 A d
508 510
509 511 test bug 4073 we need to enable obsolete markers for it
510 512
511 513 $ cat >> $HGRCPATH << EOF
512 514 > [experimental]
513 515 > evolution=createmarkers
514 516 > EOF
515 517 $ hg shelve
516 518 shelved as default
517 519 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
518 520 $ hg debugobsolete `hg --debug id -i -r 1`
519 521 $ hg unshelve
520 522 unshelving change 'default'
521 523
522 524 unshelve should leave unknown files alone (issue4113)
523 525
524 526 $ echo e > e
525 527 $ hg shelve
526 528 shelved as default
527 529 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
528 530 $ hg status
529 531 ? e
530 532 $ hg unshelve
531 533 unshelving change 'default'
532 534 $ hg status
533 535 A d
534 536 ? e
535 537 $ cat e
536 538 e
537 539
538 540 unshelve should keep a copy of unknown files
539 541
540 542 $ hg add e
541 543 $ hg shelve
542 544 shelved as default
543 545 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
544 546 $ echo z > e
545 547 $ hg unshelve
546 548 unshelving change 'default'
547 549 $ cat e
548 550 e
549 551 $ cat e.orig
550 552 z
551 553
552 554
553 555 unshelve and conflicts with tracked and untracked files
554 556
555 557 preparing:
556 558
557 559 $ rm *.orig
558 560 $ hg ci -qm 'commit stuff'
559 561 $ hg phase -p null:
560 562
561 563 no other changes - no merge:
562 564
563 565 $ echo f > f
564 566 $ hg add f
565 567 $ hg shelve
566 568 shelved as default
567 569 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
568 570 $ echo g > f
569 571 $ hg unshelve
570 572 unshelving change 'default'
571 573 $ hg st
572 574 A f
573 575 ? f.orig
574 576 $ cat f
575 577 f
576 578 $ cat f.orig
577 579 g
578 580
579 581 other uncommitted changes - merge:
580 582
581 583 $ hg st
582 584 A f
583 585 ? f.orig
584 586 $ hg shelve
585 587 shelved as default
586 588 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
587 589 $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()'
588 590 o 4 changes to 'commit stuff' shelve@localhost
589 591 |
590 592 $ hg log -G --template '{rev} {desc|firstline} {author}'
591 593 @ 3 commit stuff test
592 594 |
593 595 | o 2 c test
594 596 |/
595 597 o 0 a test
596 598
597 599 $ mv f.orig f
598 600 $ echo 1 > a
599 601 $ hg unshelve --date '1073741824 0'
600 602 unshelving change 'default'
601 603 temporarily committing pending changes (restore with 'hg unshelve --abort')
602 604 rebasing shelved changes
603 605 merging f
604 606 warning: conflicts during merge.
605 607 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
606 608 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
607 609 [1]
608 610 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
609 611 @ 5 changes to 'commit stuff' shelve@localhost 1970-01-01 00:00 +0000
610 612 |
611 613 | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
612 614 |/
613 615 o 3 commit stuff test 1970-01-01 00:00 +0000
614 616 |
615 617 | o 2 c test 1970-01-01 00:00 +0000
616 618 |/
617 619 o 0 a test 1970-01-01 00:00 +0000
618 620
619 621 $ hg st
620 622 M f
621 623 ? f.orig
622 624 $ cat f
623 625 <<<<<<< dest: 5f6b880e719b - shelve: pending changes temporary commit
624 626 g
625 627 =======
626 628 f
627 629 >>>>>>> source: 23b29cada8ba - shelve: changes to 'commit stuff'
628 630 $ cat f.orig
629 631 g
630 632 $ hg unshelve --abort
631 633 rebase aborted
632 634 unshelve of 'default' aborted
633 635 $ hg st
634 636 M a
635 637 ? f.orig
636 638 $ cat f.orig
637 639 g
638 640 $ hg unshelve
639 641 unshelving change 'default'
640 642 temporarily committing pending changes (restore with 'hg unshelve --abort')
641 643 rebasing shelved changes
642 644 $ hg st
643 645 M a
644 646 A f
645 647 ? f.orig
646 648
647 649 other committed changes - merge:
648 650
649 651 $ hg shelve f
650 652 shelved as default
651 653 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
652 654 $ hg ci a -m 'intermediate other change'
653 655 $ mv f.orig f
654 656 $ hg unshelve
655 657 unshelving change 'default'
656 658 rebasing shelved changes
657 659 merging f
658 660 warning: conflicts during merge.
659 661 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
660 662 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
661 663 [1]
662 664 $ hg st
663 665 M f
664 666 ? f.orig
665 667 $ cat f
666 668 <<<<<<< dest: * - test: intermediate other change (glob)
667 669 g
668 670 =======
669 671 f
670 672 >>>>>>> source: 23b29cada8ba - shelve: changes to 'commit stuff'
671 673 $ cat f.orig
672 674 g
673 675 $ hg unshelve --abort
674 676 rebase aborted
675 677 unshelve of 'default' aborted
676 678 $ hg st
677 679 ? f.orig
678 680 $ cat f.orig
679 681 g
680 682 $ hg shelve --delete default
681 683
682 684 Recreate some conflict again
683 685
684 686 $ cd ../repo
685 687 $ hg up -C -r 3
686 688 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
687 689 (leaving bookmark test)
688 690 $ echo y >> a/a
689 691 $ hg shelve
690 692 shelved as default
691 693 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
692 694 $ hg up test
693 695 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
694 696 (activating bookmark test)
695 697 $ hg unshelve
696 698 unshelving change 'default'
697 699 rebasing shelved changes
698 700 merging a/a
699 701 warning: conflicts during merge.
700 702 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark')
701 703 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
702 704 [1]
703 705
704 706 Test that resolving all conflicts in one direction (so that the rebase
705 707 is a no-op), works (issue4398)
706 708
707 709 $ hg revert -a -r .
708 710 reverting a/a (glob)
709 711 $ hg resolve -m a/a
710 712 (no more unresolved files)
711 713 $ hg unshelve -c
712 714 unshelve of 'default' complete
713 715 $ hg diff
714 716 $ hg status
715 717 ? a/a.orig
716 718 ? foo/foo
717 719 $ hg summary
718 720 parent: 4:33f7f61e6c5e tip
719 721 create conflict
720 722 branch: default
721 723 bookmarks: *test
722 724 commit: 2 unknown (clean)
723 725 update: (current)
724 726
725 727 $ hg shelve --delete --stat
726 728 abort: options '--delete' and '--stat' may not be used together
727 729 [255]
728 730 $ hg shelve --delete --name NAME
729 731 abort: options '--delete' and '--name' may not be used together
730 732 [255]
731 733
732 734 $ cd ..
@@ -1,355 +1,357 b''
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "color=" >> $HGRCPATH
3 $ echo "[color]" >> $HGRCPATH
4 $ echo "mode=ansi" >> $HGRCPATH
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > color =
4 > [color]
5 > mode = ansi
6 > EOF
5 7 Terminfo codes compatibility fix
6 8 $ echo "color.none=0" >> $HGRCPATH
7 9
8 10 $ hg init repo1
9 11 $ cd repo1
10 12 $ mkdir a b a/1 b/1 b/2
11 13 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
12 14
13 15 hg status in repo root:
14 16
15 17 $ hg status --color=always
16 18 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
17 19 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
18 20 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
19 21 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
20 22 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
21 23 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
22 24
23 25 $ hg status --color=debug
24 26 [status.unknown|? ][status.unknown|a/1/in_a_1]
25 27 [status.unknown|? ][status.unknown|a/in_a]
26 28 [status.unknown|? ][status.unknown|b/1/in_b_1]
27 29 [status.unknown|? ][status.unknown|b/2/in_b_2]
28 30 [status.unknown|? ][status.unknown|b/in_b]
29 31 [status.unknown|? ][status.unknown|in_root]
30 32
31 33 hg status . in repo root:
32 34
33 35 $ hg status --color=always .
34 36 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
35 37 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
36 38 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
37 39 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
38 40 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
39 41 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
40 42
41 43 $ hg status --color=always --cwd a
42 44 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
43 45 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
44 46 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
45 47 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
46 48 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
47 49 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
48 50 $ hg status --color=always --cwd a .
49 51 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
50 52 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
51 53 $ hg status --color=always --cwd a ..
52 54 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_a_1\x1b[0m (esc)
53 55 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a\x1b[0m (esc)
54 56 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/1/in_b_1\x1b[0m (esc)
55 57 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/2/in_b_2\x1b[0m (esc)
56 58 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../b/in_b\x1b[0m (esc)
57 59 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
58 60
59 61 $ hg status --color=always --cwd b
60 62 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
61 63 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
62 64 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
63 65 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
64 66 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
65 67 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
66 68 $ hg status --color=always --cwd b .
67 69 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
68 70 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
69 71 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
70 72 $ hg status --color=always --cwd b ..
71 73 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/1/in_a_1\x1b[0m (esc)
72 74 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../a/in_a\x1b[0m (esc)
73 75 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m1/in_b_1\x1b[0m (esc)
74 76 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m2/in_b_2\x1b[0m (esc)
75 77 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b\x1b[0m (esc)
76 78 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_root\x1b[0m (esc)
77 79
78 80 $ hg status --color=always --cwd a/1
79 81 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
80 82 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
81 83 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
82 84 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
83 85 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
84 86 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
85 87 $ hg status --color=always --cwd a/1 .
86 88 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
87 89 $ hg status --color=always --cwd a/1 ..
88 90 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_a_1\x1b[0m (esc)
89 91 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_a\x1b[0m (esc)
90 92
91 93 $ hg status --color=always --cwd b/1
92 94 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
93 95 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
94 96 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
95 97 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
96 98 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
97 99 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
98 100 $ hg status --color=always --cwd b/1 .
99 101 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
100 102 $ hg status --color=always --cwd b/1 ..
101 103 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_1\x1b[0m (esc)
102 104 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../2/in_b_2\x1b[0m (esc)
103 105 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
104 106
105 107 $ hg status --color=always --cwd b/2
106 108 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/1/in_a_1\x1b[0m (esc)
107 109 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4ma/in_a\x1b[0m (esc)
108 110 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/1/in_b_1\x1b[0m (esc)
109 111 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/2/in_b_2\x1b[0m (esc)
110 112 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
111 113 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc)
112 114 $ hg status --color=always --cwd b/2 .
113 115 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
114 116 $ hg status --color=always --cwd b/2 ..
115 117 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../1/in_b_1\x1b[0m (esc)
116 118 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_b_2\x1b[0m (esc)
117 119 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4m../in_b\x1b[0m (esc)
118 120
119 121 Make sure --color=never works
120 122 $ hg status --color=never
121 123 ? a/1/in_a_1
122 124 ? a/in_a
123 125 ? b/1/in_b_1
124 126 ? b/2/in_b_2
125 127 ? b/in_b
126 128 ? in_root
127 129
128 130 Make sure ui.formatted=False works
129 131 $ hg status --config ui.formatted=False
130 132 ? a/1/in_a_1
131 133 ? a/in_a
132 134 ? b/1/in_b_1
133 135 ? b/2/in_b_2
134 136 ? b/in_b
135 137 ? in_root
136 138
137 139 $ cd ..
138 140
139 141 $ hg init repo2
140 142 $ cd repo2
141 143 $ touch modified removed deleted ignored
142 144 $ echo "^ignored$" > .hgignore
143 145 $ hg ci -A -m 'initial checkin'
144 146 adding .hgignore
145 147 adding deleted
146 148 adding modified
147 149 adding removed
148 150 $ hg log --color=debug
149 151 [log.changeset changeset.draft|changeset: 0:389aef86a55e]
150 152 [log.tag|tag: tip]
151 153 [log.user|user: test]
152 154 [log.date|date: Thu Jan 01 00:00:00 1970 +0000]
153 155 [log.summary|summary: initial checkin]
154 156
155 157 Labels on empty strings should not be displayed, labels on custom
156 158 templates should be.
157 159
158 160 $ hg log --color=debug -T '{label("my.label",author)}\n{label("skipped.label","")}'
159 161 [my.label|test]
160 162 $ touch modified added unknown ignored
161 163 $ hg add added
162 164 $ hg remove removed
163 165 $ rm deleted
164 166
165 167 hg status:
166 168
167 169 $ hg status --color=always
168 170 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
169 171 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
170 172 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
171 173 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
172 174
173 175 hg status modified added removed deleted unknown never-existed ignored:
174 176
175 177 $ hg status --color=always modified added removed deleted unknown never-existed ignored
176 178 never-existed: * (glob)
177 179 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
178 180 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
179 181 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
180 182 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
181 183
182 184 $ hg copy modified copied
183 185
184 186 hg status -C:
185 187
186 188 $ hg status --color=always -C
187 189 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
188 190 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
189 191 \x1b[0;0m modified\x1b[0m (esc)
190 192 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
191 193 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
192 194 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
193 195
194 196 hg status -A:
195 197
196 198 $ hg status --color=always -A
197 199 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
198 200 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
199 201 \x1b[0;0m modified\x1b[0m (esc)
200 202 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
201 203 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
202 204 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
203 205 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
204 206 \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
205 207 \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)
206 208
207 209
208 210 hg status -A (with terminfo color):
209 211
210 212 #if tic
211 213
212 214 $ mkdir "$TESTTMP/terminfo"
213 215 $ TERMINFO="$TESTTMP/terminfo" tic "$TESTDIR/hgterm.ti"
214 216 $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config color.mode=terminfo --color=always -A
215 217 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc)
216 218 \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc)
217 219 \x1b[30m\x1b[30m modified\x1b[30m (esc)
218 220 \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc)
219 221 \x1b[30m\x1b[36m\x1b[1m\x1b[4m! \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
220 222 \x1b[30m\x1b[35m\x1b[1m\x1b[4m? \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
221 223 \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc)
222 224 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
223 225 \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
224 226
225 227 #endif
226 228
227 229
228 230 $ echo "^ignoreddir$" > .hgignore
229 231 $ mkdir ignoreddir
230 232 $ touch ignoreddir/file
231 233
232 234 hg status ignoreddir/file:
233 235
234 236 $ hg status --color=always ignoreddir/file
235 237
236 238 hg status -i ignoreddir/file:
237 239
238 240 $ hg status --color=always -i ignoreddir/file
239 241 \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignoreddir/file\x1b[0m (esc)
240 242 $ cd ..
241 243
242 244 check 'status -q' and some combinations
243 245
244 246 $ hg init repo3
245 247 $ cd repo3
246 248 $ touch modified removed deleted ignored
247 249 $ echo "^ignored$" > .hgignore
248 250 $ hg commit -A -m 'initial checkin'
249 251 adding .hgignore
250 252 adding deleted
251 253 adding modified
252 254 adding removed
253 255 $ touch added unknown ignored
254 256 $ hg add added
255 257 $ echo "test" >> modified
256 258 $ hg remove removed
257 259 $ rm deleted
258 260 $ hg copy modified copied
259 261
260 262 test unknown color
261 263
262 264 $ hg --config color.status.modified=periwinkle status --color=always
263 265 ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
264 266 M modified
265 267 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
266 268 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
267 269 \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
268 270 \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
269 271 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
270 272
271 273 Run status with 2 different flags.
272 274 Check if result is the same or different.
273 275 If result is not as expected, raise error
274 276
275 277 $ assert() {
276 278 > hg status --color=always $1 > ../a
277 279 > hg status --color=always $2 > ../b
278 280 > if diff ../a ../b > /dev/null; then
279 281 > out=0
280 282 > else
281 283 > out=1
282 284 > fi
283 285 > if [ $3 -eq 0 ]; then
284 286 > df="same"
285 287 > else
286 288 > df="different"
287 289 > fi
288 290 > if [ $out -ne $3 ]; then
289 291 > echo "Error on $1 and $2, should be $df."
290 292 > fi
291 293 > }
292 294
293 295 assert flag1 flag2 [0-same | 1-different]
294 296
295 297 $ assert "-q" "-mard" 0
296 298 $ assert "-A" "-marduicC" 0
297 299 $ assert "-qA" "-mardcC" 0
298 300 $ assert "-qAui" "-A" 0
299 301 $ assert "-qAu" "-marducC" 0
300 302 $ assert "-qAi" "-mardicC" 0
301 303 $ assert "-qu" "-u" 0
302 304 $ assert "-q" "-u" 1
303 305 $ assert "-m" "-a" 1
304 306 $ assert "-r" "-d" 1
305 307 $ cd ..
306 308
307 309 test 'resolve -l'
308 310
309 311 $ hg init repo4
310 312 $ cd repo4
311 313 $ echo "file a" > a
312 314 $ echo "file b" > b
313 315 $ hg add a b
314 316 $ hg commit -m "initial"
315 317 $ echo "file a change 1" > a
316 318 $ echo "file b change 1" > b
317 319 $ hg commit -m "head 1"
318 320 $ hg update 0
319 321 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 322 $ echo "file a change 2" > a
321 323 $ echo "file b change 2" > b
322 324 $ hg commit -m "head 2"
323 325 created new head
324 326 $ hg merge
325 327 merging a
326 328 warning: conflicts during merge.
327 329 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
328 330 merging b
329 331 warning: conflicts during merge.
330 332 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
331 333 0 files updated, 0 files merged, 0 files removed, 2 files unresolved
332 334 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
333 335 [1]
334 336 $ hg resolve -m b
335 337
336 338 hg resolve with one unresolved, one resolved:
337 339
338 340 $ hg resolve --color=always -l
339 341 \x1b[0;31;1mU a\x1b[0m (esc)
340 342 \x1b[0;32;1mR b\x1b[0m (esc)
341 343
342 344 color coding of error message with current availability of curses
343 345
344 346 $ hg unknowncommand > /dev/null
345 347 hg: unknown command 'unknowncommand'
346 348 [255]
347 349
348 350 color coding of error message without curses
349 351
350 352 $ echo 'raise ImportError' > curses.py
351 353 $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null
352 354 hg: unknown command 'unknowncommand'
353 355 [255]
354 356
355 357 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now