tests/test-tag.t
changeset 21418 d4b8fc753455
parent 21237 0054a77f49df
child 21922 50e20154cb68
equal deleted inserted replaced
21417:308aaeb956e2 21418:d4b8fc753455
    14 
    14 
    15   $ hg tag ' '
    15   $ hg tag ' '
    16   abort: tag names cannot consist entirely of whitespace
    16   abort: tag names cannot consist entirely of whitespace
    17   [255]
    17   [255]
    18 
    18 
    19   $ hg tag "bleah"
    19 (this tests also that editor is not invoked, if '--edit' is not
       
    20 specified)
       
    21 
       
    22   $ HGEDITOR=cat hg tag "bleah"
    20   $ hg history
    23   $ hg history
    21   changeset:   1:d4f0d2909abc
    24   changeset:   1:d4f0d2909abc
    22   tag:         tip
    25   tag:         tip
    23   user:        test
    26   user:        test
    24   date:        Thu Jan 01 00:00:00 1970 +0000
    27   date:        Thu Jan 01 00:00:00 1970 +0000
   217   warning: tag tag-and-branch-same-name conflicts with existing branch name
   220   warning: tag tag-and-branch-same-name conflicts with existing branch name
   218 
   221 
   219 test custom commit messages
   222 test custom commit messages
   220 
   223 
   221   $ cat > editor.sh << '__EOF__'
   224   $ cat > editor.sh << '__EOF__'
       
   225   > echo "==== before editing"
       
   226   > cat "$1"
       
   227   > echo "===="
   222   > echo "custom tag message" > "$1"
   228   > echo "custom tag message" > "$1"
   223   > echo "second line" >> "$1"
   229   > echo "second line" >> "$1"
   224   > __EOF__
   230   > __EOF__
   225 
   231 
   226 at first, test saving last-message.txt
   232 at first, test saving last-message.txt
   248   > pretag.test-saving-lastmessage =
   254   > pretag.test-saving-lastmessage =
   249   > # this failure occurs after editor invocation
   255   > # this failure occurs after editor invocation
   250   > pretxncommit.unexpectedabort = false
   256   > pretxncommit.unexpectedabort = false
   251   > __EOF__
   257   > __EOF__
   252 
   258 
       
   259 (this tests also that editor is invoked, if '--edit' is specified,
       
   260 regardless of '--message')
       
   261 
   253   $ rm -f .hg/last-message.txt
   262   $ rm -f .hg/last-message.txt
   254   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
   263   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar"
       
   264   ==== before editing
       
   265   foo bar
       
   266   
       
   267   
       
   268   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
   269   HG: Leave message empty to abort commit.
       
   270   HG: --
       
   271   HG: user: test
       
   272   HG: branch 'tag-and-branch-same-name'
       
   273   HG: changed .hgtags
       
   274   ====
   255   transaction abort!
   275   transaction abort!
   256   rollback completed
   276   rollback completed
   257   note: commit message saved in .hg/last-message.txt
   277   note: commit message saved in .hg/last-message.txt
   258   abort: pretxncommit.unexpectedabort hook exited with status 1
   278   abort: pretxncommit.unexpectedabort hook exited with status 1
   259   [255]
   279   [255]
   270   $ hg revert --no-backup -q .hgtags
   290   $ hg revert --no-backup -q .hgtags
   271 
   291 
   272 then, test custom commit message itself
   292 then, test custom commit message itself
   273 
   293 
   274   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
   294   $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e
       
   295   ==== before editing
       
   296   Added tag custom-tag for changeset 75a534207be6
       
   297   
       
   298   
       
   299   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
       
   300   HG: Leave message empty to abort commit.
       
   301   HG: --
       
   302   HG: user: test
       
   303   HG: branch 'tag-and-branch-same-name'
       
   304   HG: changed .hgtags
       
   305   ====
   275   $ hg log -l1 --template "{desc}\n"
   306   $ hg log -l1 --template "{desc}\n"
   276   custom tag message
   307   custom tag message
   277   second line
   308   second line
   278 
   309 
   279 
   310