Debian Codegraph @

tests/test-commit.t

raw
1 commit date test
2
3 $ hg init test
4 $ cd test
5 $ echo foo > foo
6 $ hg add foo
7 $ cat > $TESTTMP/checkeditform.sh <<EOF
8 > env | grep HGEDITFORM
9 > true
10 > EOF
11 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m ""
12 HGEDITFORM=commit.normal.normal
13 abort: empty commit message
14 [10]
15 $ hg commit -d '0 0' -m commit-1
16 $ echo foo >> foo
17 $ hg commit -d '1 4444444' -m commit-3
18 hg: parse error: impossible time zone offset: 4444444
19 [10]
20 $ hg commit -d '1 15.1' -m commit-4
21 hg: parse error: invalid date: '1\t15.1'
22 [10]
23 $ hg commit -d 'foo bar' -m commit-5
24 hg: parse error: invalid date: 'foo bar'
25 [10]
26 $ hg commit -d ' 1 4444' -m commit-6
27 $ hg commit -d '111111111111 0' -m commit-7
28 hg: parse error: date exceeds 32 bits: 111111111111
29 [10]
30 $ hg commit -d '-111111111111 0' -m commit-7
31 hg: parse error: date exceeds 32 bits: -111111111111
32 [10]
33 $ echo foo >> foo
34 $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2
35 $ echo foo >> foo
36 $ hg commit -d '-2147483648 0' -m commit-7-3
37 $ hg log -T '{rev} {date|isodatesec}\n' -l2
38 3 1901-12-13 20:45:52 +0000
39 2 1901-12-13 20:45:52 +0000
40 $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7
41 hg: parse error: date exceeds 32 bits: -2147483649
42 [10]
43 $ hg commit -d '-2147483649 0' -m commit-7
44 hg: parse error: date exceeds 32 bits: -2147483649
45 [10]
46
47 commit added file that has been deleted
48
49 $ echo bar > bar
50 $ hg add bar
51 $ rm bar
52 $ hg commit -m commit-8
53 nothing changed (1 missing files, see 'hg status')
54 [1]
55 $ hg commit -m commit-8-2 bar
56 abort: bar: file not found!
57 [10]
58
59 $ hg -q revert -a --no-backup
60
61 $ mkdir dir
62 $ echo boo > dir/file
63 $ hg add
64 adding dir/file
65 $ hg -v commit -m commit-9 dir
66 committing files:
67 dir/file
68 committing manifest
69 committing changelog
70 committed changeset 4:1957363f1ced
71
72 $ echo > dir.file
73 $ hg add
74 adding dir.file
75 $ hg commit -m commit-10 dir dir.file
76 abort: dir: no match under directory!
77 [10]
78
79 $ echo >> dir/file
80 $ mkdir bleh
81 $ mkdir dir2
82 $ cd bleh
83 $ hg commit -m commit-11 .
84 abort: bleh: no match under directory!
85 [10]
86 $ hg commit -m commit-12 ../dir ../dir2
87 abort: dir2: no match under directory!
88 [10]
89 $ hg -v commit -m commit-13 ../dir
90 committing files:
91 dir/file
92 committing manifest
93 committing changelog
94 committed changeset 5:a31d8f87544a
95 $ cd ..
96
97 $ hg commit -m commit-14 does-not-exist
98 abort: does-not-exist: * (glob)
99 [10]
100
101 #if symlink
102 $ ln -s foo baz
103 $ hg commit -m commit-15 baz
104 abort: baz: file not tracked!
105 [10]
106 $ rm baz
107 #endif
108
109 $ touch quux
110 $ hg commit -m commit-16 quux
111 abort: quux: file not tracked!
112 [10]
113 $ echo >> dir/file
114 $ hg -v commit -m commit-17 dir/file
115 committing files:
116 dir/file
117 committing manifest
118 committing changelog
119 committed changeset 6:32d054c9d085
120
121 An empty date was interpreted as epoch origin
122
123 $ echo foo >> foo
124 $ hg commit -d '' -m commit-no-date --config devel.default-date=
125 $ hg tip --template '{date|isodate}\n' | grep '1970'
126 [1]
127
128 Using the advanced --extra flag
129
130 $ echo "[extensions]" >> $HGRCPATH
131 $ echo "commitextras=" >> $HGRCPATH
132 $ hg status
133 ? quux
134 $ hg add quux
135 $ hg commit -m "adding internal used extras" --extra amend_source=hash
136 abort: key 'amend_source' is used internally, can't be set manually
137 [10]
138 $ hg commit -m "special chars in extra" --extra id@phab=214
139 abort: keys can only contain ascii letters, digits, '_' and '-'
140 [10]
141 $ hg commit -m "empty key" --extra =value
142 abort: unable to parse '=value', keys can't be empty
143 [10]
144 $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar
145 $ hg log -r . -T '{extras % "{extra}\n"}'
146 branch=default
147 oldhash=bar
148 sourcehash=foo
149
150 Failed commit with --addremove should not update dirstate
151
152 $ echo foo > newfile
153 $ hg status
154 ? newfile
155 $ HGEDITOR=false hg ci --addremove
156 adding newfile
157 abort: edit failed: false exited with status 1
158 [250]
159 $ hg status
160 ? newfile
161
162 Make sure we do not obscure unknown requires file entries (issue2649)
163
164 $ echo foo >> foo
165 $ echo fake >> .hg/requires
166 $ hg commit -m bla
167 abort: repository requires features unknown to this Mercurial: fake
168 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
169 [255]
170
171 $ cd ..
172
173
174 partial subdir commit test
175
176 $ hg init test2
177 $ cd test2
178 $ mkdir foo
179 $ echo foo > foo/foo
180 $ mkdir bar
181 $ echo bar > bar/bar
182 $ hg add
183 adding bar/bar
184 adding foo/foo
185 $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo
186 commit-subdir-1
187
188
189 HG: Enter commit message. Lines beginning with 'HG:' are removed.
190 HG: Leave message empty to abort commit.
191 HG: --
192 HG: user: test
193 HG: branch 'default'
194 HG: added foo/foo
195
196
197 $ hg ci -m commit-subdir-2 bar
198
199 subdir log 1
200
201 $ hg log -v foo
202 changeset: 0:f97e73a25882
203 user: test
204 date: Thu Jan 01 00:00:00 1970 +0000
205 files: foo/foo
206 description:
207 commit-subdir-1
208
209
210
211 subdir log 2
212
213 $ hg log -v bar
214 changeset: 1:aa809156d50d
215 tag: tip
216 user: test
217 date: Thu Jan 01 00:00:00 1970 +0000
218 files: bar/bar
219 description:
220 commit-subdir-2
221
222
223
224 full log
225
226 $ hg log -v
227 changeset: 1:aa809156d50d
228 tag: tip
229 user: test
230 date: Thu Jan 01 00:00:00 1970 +0000
231 files: bar/bar
232 description:
233 commit-subdir-2
234
235
236 changeset: 0:f97e73a25882
237 user: test
238 date: Thu Jan 01 00:00:00 1970 +0000
239 files: foo/foo
240 description:
241 commit-subdir-1
242
243
244 $ cd ..
245
246
247 dot and subdir commit test
248
249 $ hg init test3
250 $ echo commit-foo-subdir > commit-log-test
251 $ cd test3
252 $ mkdir foo
253 $ echo foo content > foo/plain-file
254 $ hg add foo/plain-file
255 $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo
256 commit-foo-subdir
257
258
259 HG: Enter commit message. Lines beginning with 'HG:' are removed.
260 HG: Leave message empty to abort commit.
261 HG: --
262 HG: user: test
263 HG: branch 'default'
264 HG: added foo/plain-file
265
266
267 $ echo modified foo content > foo/plain-file
268 $ hg ci -m commit-foo-dot .
269
270 full log
271
272 $ hg log -v
273 changeset: 1:95b38e3a5b2e
274 tag: tip
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
277 files: foo/plain-file
278 description:
279 commit-foo-dot
280
281
282 changeset: 0:65d4e9386227
283 user: test
284 date: Thu Jan 01 00:00:00 1970 +0000
285 files: foo/plain-file
286 description:
287 commit-foo-subdir
288
289
290
291 subdir log
292
293 $ cd foo
294 $ hg log .
295 changeset: 1:95b38e3a5b2e
296 tag: tip
297 user: test
298 date: Thu Jan 01 00:00:00 1970 +0000
299 summary: commit-foo-dot
300
301 changeset: 0:65d4e9386227
302 user: test
303 date: Thu Jan 01 00:00:00 1970 +0000
304 summary: commit-foo-subdir
305
306 $ cd ..
307 $ cd ..
308
309 Issue1049: Hg permits partial commit of merge without warning
310
311 $ hg init issue1049
312 $ cd issue1049
313 $ echo a > a
314 $ hg ci -Ama
315 adding a
316 $ echo a >> a
317 $ hg ci -mb
318 $ hg up 0
319 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 $ echo b >> a
321 $ hg ci -mc
322 created new head
323 $ HGMERGE=true hg merge
324 merging a
325 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
326 (branch merge, don't forget to commit)
327
328 should fail because we are specifying a file name
329
330 $ hg ci -mmerge a
331 abort: cannot partially commit a merge (do not specify files or patterns)
332 [255]
333
334 should fail because we are specifying a pattern
335
336 $ hg ci -mmerge -I a
337 abort: cannot partially commit a merge (do not specify files or patterns)
338 [255]
339
340 should succeed
341
342 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit
343 HGEDITFORM=commit.normal.merge
344 $ cd ..
345
346
347 test commit message content
348
349 $ hg init commitmsg
350 $ cd commitmsg
351 $ echo changed > changed
352 $ echo removed > removed
353 $ hg book activebookmark
354 $ hg ci -qAm init
355
356 $ hg rm removed
357 $ echo changed >> changed
358 $ echo added > added
359 $ hg add added
360 $ HGEDITOR=cat hg ci -A
361
362
363 HG: Enter commit message. Lines beginning with 'HG:' are removed.
364 HG: Leave message empty to abort commit.
365 HG: --
366 HG: user: test
367 HG: branch 'default'
368 HG: bookmark 'activebookmark'
369 HG: added added
370 HG: changed changed
371 HG: removed removed
372 abort: empty commit message
373 [10]
374
375 test saving last-message.txt
376
377 $ hg init sub
378 $ echo a > sub/a
379 $ hg -R sub add sub/a
380 $ cat > sub/.hg/hgrc <<EOF
381 > [hooks]
382 > precommit.test-saving-last-message = false
383 > EOF
384
385 $ echo 'sub = sub' > .hgsub
386 $ hg add .hgsub
387
388 $ cat > $TESTTMP/editor.sh <<EOF
389 > echo "==== before editing:"
390 > cat \$1
391 > echo "===="
392 > echo "test saving last-message.txt" >> \$1
393 > EOF
394
395 $ rm -f .hg/last-message.txt
396 $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q
397 ==== before editing:
398
399
400 HG: Enter commit message. Lines beginning with 'HG:' are removed.
401 HG: Leave message empty to abort commit.
402 HG: --
403 HG: user: test
404 HG: branch 'default'
405 HG: bookmark 'activebookmark'
406 HG: subrepo sub
407 HG: added .hgsub
408 HG: added added
409 HG: changed .hgsubstate
410 HG: changed changed
411 HG: removed removed
412 ====
413 abort: precommit.test-saving-last-message hook exited with status 1 (in subrepository "sub")
414 [255]
415 $ cat .hg/last-message.txt
416
417
418 test saving last-message.txt
419
420 test that '[committemplate] changeset' definition and commit log
421 specific template keywords work well
422
423 $ cat >> .hg/hgrc <<EOF
424 > [committemplate]
425 > changeset.commit.normal = 'HG: this is "commit.normal" template
426 > HG: {extramsg}
427 > {if(activebookmark,
428 > "HG: bookmark '{activebookmark}' is activated\n",
429 > "HG: no bookmark is activated\n")}{subrepos %
430 > "HG: subrepo '{subrepo}' is changed\n"}'
431 >
432 > changeset.commit = HG: this is "commit" template
433 > HG: {extramsg}
434 > {if(activebookmark,
435 > "HG: bookmark '{activebookmark}' is activated\n",
436 > "HG: no bookmark is activated\n")}{subrepos %
437 > "HG: subrepo '{subrepo}' is changed\n"}
438 >
439 > changeset = HG: this is customized commit template
440 > HG: {extramsg}
441 > {if(activebookmark,
442 > "HG: bookmark '{activebookmark}' is activated\n",
443 > "HG: no bookmark is activated\n")}{subrepos %
444 > "HG: subrepo '{subrepo}' is changed\n"}
445 > EOF
446
447 $ hg init sub2
448 $ echo a > sub2/a
449 $ hg -R sub2 add sub2/a
450 $ echo 'sub2 = sub2' >> .hgsub
451
452 $ HGEDITOR=cat hg commit -S -q
453 HG: this is "commit.normal" template
454 HG: Leave message empty to abort commit.
455 HG: bookmark 'activebookmark' is activated
456 HG: subrepo 'sub' is changed
457 HG: subrepo 'sub2' is changed
458 abort: empty commit message
459 [10]
460
461 $ cat >> .hg/hgrc <<EOF
462 > [committemplate]
463 > changeset.commit.normal =
464 > # now, "changeset.commit" should be chosen for "hg commit"
465 > EOF
466
467 $ hg bookmark --inactive activebookmark
468 $ hg forget .hgsub
469 $ HGEDITOR=cat hg commit -q
470 HG: this is "commit" template
471 HG: Leave message empty to abort commit.
472 HG: no bookmark is activated
473 abort: empty commit message
474 [10]
475
476 $ cat >> .hg/hgrc <<EOF
477 > [committemplate]
478 > changeset.commit =
479 > # now, "changeset" should be chosen for "hg commit"
480 > EOF
481
482 $ HGEDITOR=cat hg commit -q
483 HG: this is customized commit template
484 HG: Leave message empty to abort commit.
485 HG: no bookmark is activated
486 abort: empty commit message
487 [10]
488
489 $ cat >> .hg/hgrc <<EOF
490 > [committemplate]
491 > changeset = {desc}
492 > HG: mods={file_mods}
493 > HG: adds={file_adds}
494 > HG: dels={file_dels}
495 > HG: files={files}
496 > HG:
497 > {splitlines(diff()) % 'HG: {line}\n'
498 > }HG:
499 > HG: mods={file_mods}
500 > HG: adds={file_adds}
501 > HG: dels={file_dels}
502 > HG: files={files}\n
503 > EOF
504 $ hg status -amr
505 M changed
506 A added
507 R removed
508 $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed
509 foo bar
510 HG: mods=changed
511 HG: adds=
512 HG: dels=
513 HG: files=changed
514 HG:
515 HG: diff -r d2313f97106f changed
516 HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000
517 HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000
518 HG: @@ -1,1 +1,2 @@
519 HG: changed
520 HG: +changed
521 HG:
522 HG: mods=changed
523 HG: adds=
524 HG: dels=
525 HG: files=changed
526 $ hg status -amr
527 A added
528 R removed
529 $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n"
530 M changed
531 A
532 R
533 $ hg rollback -q
534
535 $ cat >> .hg/hgrc <<EOF
536 > [committemplate]
537 > changeset = {desc}
538 > HG: mods={file_mods}
539 > HG: adds={file_adds}
540 > HG: dels={file_dels}
541 > HG: files={files}
542 > HG:
543 > {splitlines(diff("changed")) % 'HG: {line}\n'
544 > }HG:
545 > HG: mods={file_mods}
546 > HG: adds={file_adds}
547 > HG: dels={file_dels}
548 > HG: files={files}
549 > HG:
550 > {splitlines(diff("added")) % 'HG: {line}\n'
551 > }HG:
552 > HG: mods={file_mods}
553 > HG: adds={file_adds}
554 > HG: dels={file_dels}
555 > HG: files={files}
556 > HG:
557 > {splitlines(diff("removed")) % 'HG: {line}\n'
558 > }HG:
559 > HG: mods={file_mods}
560 > HG: adds={file_adds}
561 > HG: dels={file_dels}
562 > HG: files={files}\n
563 > EOF
564 $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed
565 foo bar
566 HG: mods=
567 HG: adds=added
568 HG: dels=removed
569 HG: files=added removed
570 HG:
571 HG:
572 HG: mods=
573 HG: adds=added
574 HG: dels=removed
575 HG: files=added removed
576 HG:
577 HG: diff -r d2313f97106f added
578 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
579 HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000
580 HG: @@ -0,0 +1,1 @@
581 HG: +added
582 HG:
583 HG: mods=
584 HG: adds=added
585 HG: dels=removed
586 HG: files=added removed
587 HG:
588 HG: diff -r d2313f97106f removed
589 HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000
590 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
591 HG: @@ -1,1 +0,0 @@
592 HG: -removed
593 HG:
594 HG: mods=
595 HG: adds=added
596 HG: dels=removed
597 HG: files=added removed
598 $ hg status -amr
599 M changed
600 $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n"
601 M
602 A added
603 R removed
604 $ hg rollback -q
605
606 $ cat >> .hg/hgrc <<EOF
607 > # disable customizing for subsequent tests
608 > [committemplate]
609 > changeset =
610 > EOF
611
612 $ cd ..
613
614
615 commit copy
616
617 $ hg init dir2
618 $ cd dir2
619 $ echo bleh > bar
620 $ hg add bar
621 $ hg ci -m 'add bar'
622
623 $ hg cp bar foo
624 $ echo >> bar
625 $ hg ci -m 'cp bar foo; change bar'
626
627 $ hg debugrename foo
628 foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9
629 $ hg debugindex bar
630 rev linkrev nodeid p1-nodeid p2-nodeid
631 0 0 26d3ca0dfd18 000000000000 000000000000
632 1 1 d267bddd54f7 26d3ca0dfd18 000000000000
633
634 Test making empty commits
635 $ hg commit --config ui.allowemptycommit=True -m "empty commit"
636 $ hg log -r . -v --stat
637 changeset: 2:d809f3644287
638 tag: tip
639 user: test
640 date: Thu Jan 01 00:00:00 1970 +0000
641 description:
642 empty commit
643
644
645
646 verify pathauditor blocks evil filepaths
647 $ cat > evil-commit.py <<EOF
648 > from mercurial import context, hg, ui as uimod
649 > from mercurial.repo import factory
650 > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc'
651 > u = uimod.ui.load()
652 > r = factory.repository(u, b'.')
653 > def filectxfn(repo, memctx, path):
654 > return context.memfilectx(repo, memctx, path,
655 > b'[hooks]\nupdate = echo owned')
656 > c = context.memctx(r, [r.changelog.tip(), r.nullid],
657 > b'evil', [notrc], filectxfn, 0)
658 > r.commitctx(c)
659 > EOF
660 $ "$PYTHON" evil-commit.py
661 #if windows
662 $ hg co --clean tip
663 abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc)
664 [10]
665 #else
666 $ hg co --clean tip
667 abort: path contains illegal component: .h\xe2\x80\x8cg/hgrc (esc)
668 [10]
669 #endif
670
671 $ hg rollback -f
672 repository tip rolled back to revision 2 (undo commit)
673 $ cat > evil-commit.py <<EOF
674 > from mercurial import context, ui as uimod
675 > from mercurial.repo import factory
676 > notrc = b"HG~1/hgrc"
677 > u = uimod.ui.load()
678 > r = factory.repository(u, b'.')
679 > def filectxfn(repo, memctx, path):
680 > return context.memfilectx(repo, memctx, path,
681 > b'[hooks]\nupdate = echo owned')
682 > c = context.memctx(r, [r[b'tip'].node(), r.nullid],
683 > b'evil', [notrc], filectxfn, 0)
684 > r.commitctx(c)
685 > EOF
686 $ "$PYTHON" evil-commit.py
687 $ hg co --clean tip
688 abort: path contains illegal component: HG~1/hgrc
689 [10]
690
691 $ hg rollback -f
692 repository tip rolled back to revision 2 (undo commit)
693 $ cat > evil-commit.py <<EOF
694 > from mercurial import context, ui as uimod
695 > from mercurial.repo import factory
696 > notrc = b"HG8B6C~2/hgrc"
697 > u = uimod.ui.load()
698 > r = factory.repository(u, b'.')
699 > def filectxfn(repo, memctx, path):
700 > return context.memfilectx(repo, memctx, path,
701 > b'[hooks]\nupdate = echo owned')
702 > c = context.memctx(r, [r[b'tip'].node(), r.nullid],
703 > b'evil', [notrc], filectxfn, 0)
704 > r.commitctx(c)
705 > EOF
706 $ "$PYTHON" evil-commit.py
707 $ hg co --clean tip
708 abort: path contains illegal component: HG8B6C~2/hgrc
709 [10]
710
711 $ cd ..
712
713 # test that an unmodified commit template message aborts
714
715 $ hg init unmodified_commit_template
716 $ cd unmodified_commit_template
717 $ echo foo > foo
718 $ hg add foo
719 $ hg commit -m "foo"
720 $ cat >> .hg/hgrc <<EOF
721 > [committemplate]
722 > changeset.commit = HI THIS IS NOT STRIPPED
723 > HG: this is customized commit template
724 > HG: {extramsg}
725 > {if(activebookmark,
726 > "HG: bookmark '{activebookmark}' is activated\n",
727 > "HG: no bookmark is activated\n")}{subrepos %
728 > "HG: subrepo '{subrepo}' is changed\n"}
729 > EOF
730 $ cat > $TESTTMP/notouching.sh <<EOF
731 > true
732 > EOF
733 $ echo foo2 > foo2
734 $ hg add foo2
735 $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit
736 abort: commit message unchanged
737 [10]
738
739 $ cd ..
740
741 test that text below the --- >8 --- special string is ignored
742
743 $ cat <<'EOF' > $TESTTMP/lowercaseline.sh
744 > cat $1 | sed s/LINE/line/ | tee $1.new
745 > mv $1.new $1
746 > EOF
747
748 $ hg init ignore_below_special_string
749 $ cd ignore_below_special_string
750 $ echo foo > foo
751 $ hg add foo
752 $ hg commit -m "foo"
753 $ cat >> .hg/hgrc <<EOF
754 > [committemplate]
755 > changeset.commit = first LINE
756 > HG: this is customized commit template
757 > HG: {extramsg}
758 > HG: ------------------------ >8 ------------------------
759 > {diff()}
760 > EOF
761 $ echo foo2 > foo2
762 $ hg add foo2
763 $ HGEDITOR="sh $TESTTMP/notouching.sh" hg ci
764 abort: commit message unchanged
765 [10]
766 $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci
767 first line
768 HG: this is customized commit template
769 HG: Leave message empty to abort commit.
770 HG: ------------------------ >8 ------------------------
771 diff -r e63c23eaa88a foo2
772 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
773 +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000
774 @@ -0,0 +1,1 @@
775 +foo2
776 $ hg log -T '{desc}\n' -r .
777 first line
778
779 test that the special string --- >8 --- isn't used when not at the beginning of
780 a line
781
782 $ cat >> .hg/hgrc <<EOF
783 > [committemplate]
784 > changeset.commit = first LINE2
785 > another line HG: ------------------------ >8 ------------------------
786 > HG: this is customized commit template
787 > HG: {extramsg}
788 > HG: ------------------------ >8 ------------------------
789 > {diff()}
790 > EOF
791 $ echo foo >> foo
792 $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci
793 first line2
794 another line HG: ------------------------ >8 ------------------------
795 HG: this is customized commit template
796 HG: Leave message empty to abort commit.
797 HG: ------------------------ >8 ------------------------
798 diff -r 3661b22b0702 foo
799 --- a/foo Thu Jan 01 00:00:00 1970 +0000
800 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
801 @@ -1,1 +1,2 @@
802 foo
803 +foo
804 $ hg log -T '{desc}\n' -r .
805 first line2
806 another line HG: ------------------------ >8 ------------------------
807
808 also test that this special string isn't accepted when there is some extra text
809 at the end
810
811 $ cat >> .hg/hgrc <<EOF
812 > [committemplate]
813 > changeset.commit = first LINE3
814 > HG: ------------------------ >8 ------------------------foobar
815 > second line
816 > HG: this is customized commit template
817 > HG: {extramsg}
818 > HG: ------------------------ >8 ------------------------
819 > {diff()}
820 > EOF
821 $ echo foo >> foo
822 $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci
823 first line3
824 HG: ------------------------ >8 ------------------------foobar
825 second line
826 HG: this is customized commit template
827 HG: Leave message empty to abort commit.
828 HG: ------------------------ >8 ------------------------
829 diff -r ce648f5f066f foo
830 --- a/foo Thu Jan 01 00:00:00 1970 +0000
831 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
832 @@ -1,2 +1,3 @@
833 foo
834 foo
835 +foo
836 $ hg log -T '{desc}\n' -r .
837 first line3
838 second line
839
840 $ cd ..
841
842 testing commands.commit.post-status config option
843
844 $ hg init ci-post-st
845 $ cd ci-post-st
846 $ echo '[commands]' > .hg/hgrc
847 $ echo 'commit.post-status = 1' >> .hg/hgrc
848
849 $ echo 'ignored-file' > .hgignore
850 $ hg ci -qAm 0
851
852 $ echo 'c' > clean-file
853 $ echo 'a' > added-file
854 $ echo '?' > unknown-file
855 $ echo 'i' > ignored-file
856 $ hg add clean-file added-file
857 $ hg ci -m 1 clean-file
858 A added-file
859 ? unknown-file
860 $ hg st -mardu
861 A added-file
862 ? unknown-file
863
864 $ touch modified-file
865 $ hg add modified-file
866 $ hg ci -m 2 modified-file -q
867
868 $ echo 'm' > modified-file
869 $ hg ci --amend -m 'reworded' -X 're:'
870 saved backup bundle to $TESTTMP/ci-post-st/.hg/strip-backup/*-amend.hg (glob)
871 M modified-file
872 A added-file
873 ? unknown-file
874 $ hg st -mardu
875 M modified-file
876 A added-file
877 ? unknown-file
878
879 $ cd ..