tests/test-keyword
branchkwmap-templates
changeset 189 247159261ba5
child 202 e2a2f9ca8271
equal deleted inserted replaced
188:c5e1a361d009 189:247159261ba5
       
     1 #!/bin/sh
       
     2 
       
     3 cat <<EOF >> $HGRCPATH
       
     4 [extensions]
       
     5 hgext.keyword =
       
     6 [keyword]
       
     7 * =
       
     8 b = ignore
       
     9 EOF
       
    10 
       
    11 echo % help
       
    12 hg help keyword
       
    13 
       
    14 echo % hg kwdemo
       
    15 hg --quiet kwdemo --default \
       
    16 | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
       
    17  -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
       
    18  -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
       
    19  -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
       
    20 
       
    21 hg init Test
       
    22 cd Test
       
    23 
       
    24 echo % kwshrink should abort in empty/invalid repo
       
    25 hg kwshrink
       
    26 
       
    27 echo 'expand $Id$' > a
       
    28 echo 'ignore $Id$' > b
       
    29 echo % cat
       
    30 cat a b
       
    31 
       
    32 echo % default keyword expansion
       
    33 echo % commit
       
    34 hg --debug commit -A -mab -d '0 0' -u 'User Name <user@example.com>'
       
    35 echo % status
       
    36 hg status
       
    37 echo % identify
       
    38 hg --quiet identify
       
    39 echo % cat
       
    40 cat a b
       
    41 echo % hg cat
       
    42 hg cat a b
       
    43 
       
    44 echo % touch
       
    45 touch a b
       
    46 echo % status
       
    47 hg status
       
    48 
       
    49 rm a b
       
    50 echo % update
       
    51 hg update
       
    52 echo % cat
       
    53 cat a b
       
    54 
       
    55 echo % copy
       
    56 hg cp a c
       
    57 echo % commit
       
    58 hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
       
    59 echo % cat a c
       
    60 cat a c
       
    61 echo % touch copied c
       
    62 touch c
       
    63 echo % status
       
    64 
       
    65 echo % rollback
       
    66 hg rollback
       
    67 echo % status
       
    68 hg status
       
    69 echo % update -C
       
    70 hg update --clean
       
    71 
       
    72 echo % custom keyword expansion
       
    73 echo % try with kwdemo
       
    74 hg --quiet kwdemo "Xinfo = {author}: {desc}"
       
    75 
       
    76 cat <<EOF >>$HGRCPATH
       
    77 [keywordmaps]
       
    78 Id = {file} {node|short} {date|rfc822date} {author|user}
       
    79 Xinfo = {author}: {desc}
       
    80 EOF
       
    81 
       
    82 echo % cat
       
    83 cat a b
       
    84 echo % hg cat
       
    85 hg cat a b
       
    86 
       
    87 echo '$Xinfo$' >> a
       
    88 cat <<EOF >> log
       
    89 firstline
       
    90 secondline
       
    91 EOF
       
    92 
       
    93 echo % interrupted commit
       
    94 HGEDITOR=false hg commit
       
    95 echo % status
       
    96 hg status
       
    97 
       
    98 echo % commit
       
    99 hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
       
   100 rm log
       
   101 echo % status
       
   102 hg status
       
   103 
       
   104 echo % cat
       
   105 cat a b
       
   106 echo % hg cat
       
   107 hg cat a b
       
   108 
       
   109 cd ..
       
   110 hg clone -r0 Test Test-a
       
   111 cd Test-a
       
   112 cat <<EOF >> .hg/hgrc
       
   113 [paths]
       
   114 default = ../Test
       
   115 EOF
       
   116 echo % incoming
       
   117 # remove path to temp dir
       
   118 hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
       
   119 
       
   120 echo % switch off expansion
       
   121 cd ../Test
       
   122 echo % kwshrink
       
   123 hg --debug kwshrink
       
   124 echo % cat
       
   125 cat a b
       
   126 echo % hg cat
       
   127 hg cat a b
       
   128 
       
   129 rm $HGRCPATH
       
   130 echo % cat
       
   131 cat a b
       
   132 echo % hg cat
       
   133 hg cat a b