tests/test-commit-amend.t
branchstable
changeset 20771 434619dae569
parent 20700 b0153cb8b64e
child 21036 a1a1bd09e4f4
equal deleted inserted replaced
20770:5d22cadd1938 20771:434619dae569
   163   $ cat > editor.sh << '__EOF__'
   163   $ cat > editor.sh << '__EOF__'
   164   > #!/bin/sh
   164   > #!/bin/sh
   165   > cat $1
   165   > cat $1
   166   > echo "another precious commit message" > "$1"
   166   > echo "another precious commit message" > "$1"
   167   > __EOF__
   167   > __EOF__
       
   168 
       
   169 at first, test saving last-message.txt
       
   170 
       
   171   $ cat > .hg/hgrc << '__EOF__'
       
   172   > [hooks]
       
   173   > pretxncommit.test-saving-last-message = false
       
   174   > __EOF__
       
   175 
       
   176   $ rm -f .hg/last-message.txt
       
   177   $ hg commit --amend -v -m "message given from command line"
       
   178   amending changeset 5f357c7560ab
       
   179   copying changeset 5f357c7560ab to ad120869acf0
       
   180   a
       
   181   running hook pretxncommit.test-saving-last-message: false
       
   182   transaction abort!
       
   183   rollback completed
       
   184   abort: pretxncommit.test-saving-last-message hook exited with status 1
       
   185   [255]
       
   186   $ cat .hg/last-message.txt
       
   187   message given from command line (no-eol)
       
   188 
       
   189   $ rm -f .hg/last-message.txt
       
   190   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
       
   191   amending changeset 5f357c7560ab
       
   192   copying changeset 5f357c7560ab to ad120869acf0
       
   193   no changes, new message
       
   194   
       
   195   
       
   196   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
   197   HG: Leave message empty to abort commit.
       
   198   HG: --
       
   199   HG: user: foo
       
   200   HG: branch 'default'
       
   201   HG: changed a
       
   202   a
       
   203   running hook pretxncommit.test-saving-last-message: false
       
   204   transaction abort!
       
   205   rollback completed
       
   206   abort: pretxncommit.test-saving-last-message hook exited with status 1
       
   207   [255]
       
   208 
       
   209   $ cat .hg/last-message.txt
       
   210   another precious commit message
       
   211 
       
   212   $ cat > .hg/hgrc << '__EOF__'
       
   213   > [hooks]
       
   214   > pretxncommit.test-saving-last-message =
       
   215   > __EOF__
       
   216 
       
   217 then, test editing custom commit message
       
   218 
   168   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
   219   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
   169   amending changeset 5f357c7560ab
   220   amending changeset 5f357c7560ab
   170   copying changeset 5f357c7560ab to ad120869acf0
   221   copying changeset 5f357c7560ab to ad120869acf0
   171   no changes, new message
   222   no changes, new message
   172   
   223