tests/test-commit.t
changeset 30703 5c85c93cdd61
parent 30559 d83ca854fa21
child 30723 6ef9f32d76c6
equal deleted inserted replaced
30702:7e4f431206cd 30703:5c85c93cdd61
   687   $ echo foo2 > foo2
   687   $ echo foo2 > foo2
   688   $ hg add foo2
   688   $ hg add foo2
   689   $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit
   689   $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit
   690   abort: commit message unchanged
   690   abort: commit message unchanged
   691   [255]
   691   [255]
       
   692 
       
   693 test that text below the --- >8 --- special string is ignored
       
   694 
       
   695   $ hg init ignore_below_special_string
       
   696   $ cd ignore_below_special_string
       
   697   $ echo foo > foo
       
   698   $ hg add foo
       
   699   $ hg commit -m "foo"
       
   700   $ cat >> .hg/hgrc <<EOF
       
   701   > [committemplate]
       
   702   > changeset.commit = first line
       
   703   >     HG: this is customized commit template
       
   704   >     HG: {extramsg}
       
   705   >     HG: ------------------------ >8 ------------------------
       
   706   >     {diff()}
       
   707   > EOF
       
   708   $ echo foo2 > foo2
       
   709   $ hg add foo2
       
   710   $ HGEDITOR=cat hg ci
       
   711   first line
       
   712   HG: this is customized commit template
       
   713   HG: Leave message empty to abort commit.
       
   714   HG: ------------------------ >8 ------------------------
       
   715   diff -r e63c23eaa88a foo2
       
   716   --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       
   717   +++ b/foo2	Thu Jan 01 00:00:00 1970 +0000
       
   718   @@ -0,0 +1,1 @@
       
   719   +foo2
       
   720   $ hg log -T '{desc}\n' -r .
       
   721   first line
       
   722 
       
   723 test that the special string --- >8 --- isn't used when not at the beginning of
       
   724 a line
       
   725 
       
   726   $ cat >> .hg/hgrc <<EOF
       
   727   > [committemplate]
       
   728   > changeset.commit = first line2
       
   729   >     another line HG: ------------------------ >8 ------------------------
       
   730   >     HG: this is customized commit template
       
   731   >     HG: {extramsg}
       
   732   >     HG: ------------------------ >8 ------------------------
       
   733   >     {diff()}
       
   734   > EOF
       
   735   $ echo foo >> foo
       
   736   $ HGEDITOR=cat hg ci
       
   737   first line2
       
   738   another line HG: ------------------------ >8 ------------------------
       
   739   HG: this is customized commit template
       
   740   HG: Leave message empty to abort commit.
       
   741   HG: ------------------------ >8 ------------------------
       
   742   diff -r 3661b22b0702 foo
       
   743   --- a/foo	Thu Jan 01 00:00:00 1970 +0000
       
   744   +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
       
   745   @@ -1,1 +1,2 @@
       
   746    foo
       
   747   +foo
       
   748   $ hg log -T '{desc}\n' -r .
       
   749   first line2
       
   750   another line HG: ------------------------ >8 ------------------------
       
   751 
       
   752 also test that this special string isn't accepted when there is some extra text
       
   753 at the end
       
   754 
       
   755   $ cat >> .hg/hgrc <<EOF
       
   756   > [committemplate]
       
   757   > changeset.commit = first line3
       
   758   >     HG: ------------------------ >8 ------------------------foobar
       
   759   >     second line
       
   760   >     HG: this is customized commit template
       
   761   >     HG: {extramsg}
       
   762   >     HG: ------------------------ >8 ------------------------
       
   763   >     {diff()}
       
   764   > EOF
       
   765   $ echo foo >> foo
       
   766   $ HGEDITOR=cat hg ci
       
   767   first line3
       
   768   HG: ------------------------ >8 ------------------------foobar
       
   769   second line
       
   770   HG: this is customized commit template
       
   771   HG: Leave message empty to abort commit.
       
   772   HG: ------------------------ >8 ------------------------
       
   773   diff -r ce648f5f066f foo
       
   774   --- a/foo	Thu Jan 01 00:00:00 1970 +0000
       
   775   +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
       
   776   @@ -1,2 +1,3 @@
       
   777    foo
       
   778    foo
       
   779   +foo
       
   780   $ hg log -T '{desc}\n' -r .
       
   781   first line3
       
   782   second line
       
   783 
   692   $ cd ..
   784   $ cd ..
       
   785