tests/test-notify
changeset 12473 52aac5c5c2a6
parent 12472 17c62039cadd
child 12474 f213af8211cc
equal deleted inserted replaced
12472:17c62039cadd 12473:52aac5c5c2a6
     1 #!/bin/sh
       
     2 
       
     3 cat <<EOF >> $HGRCPATH
       
     4 [extensions]
       
     5 notify=
       
     6 
       
     7 [hooks]
       
     8 incoming.notify = python:hgext.notify.hook
       
     9 
       
    10 [notify]
       
    11 sources = pull
       
    12 diffstat = False
       
    13 
       
    14 [usersubs]
       
    15 foo@bar = *
       
    16 
       
    17 [reposubs]
       
    18 * = baz
       
    19 EOF
       
    20 
       
    21 hg help notify
       
    22 hg init a
       
    23 echo a > a/a
       
    24 echo % commit
       
    25 hg --traceback --cwd a commit -Ama -d '0 0'
       
    26 
       
    27 echo % clone
       
    28 hg --traceback clone a b
       
    29 
       
    30 echo a >> a/a
       
    31 echo % commit
       
    32 hg --traceback --cwd a commit -Amb -d '1 0'
       
    33 
       
    34 # on Mac OS X 10.5 the tmp path is very long so would get stripped in the subject line
       
    35 cat <<EOF >> $HGRCPATH
       
    36 [notify]
       
    37 maxsubject = 200
       
    38 EOF
       
    39 
       
    40 # the python call below wraps continuation lines, which appear on Mac OS X 10.5 because
       
    41 # of the very long subject line
       
    42 echo '% pull (minimal config)'
       
    43 hg --traceback --cwd b pull ../a 2>&1 |
       
    44   python -c 'import sys,re; print re.sub("([n:])\\n[\\t ]", "\\1 ", sys.stdin.read()),' |
       
    45   sed -e 's/\(Message-Id:\).*/\1/' \
       
    46   -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \
       
    47   -e 's/^details: .*test-notify/details: test-notify/' \
       
    48   -e 's/^Date:.*/Date:/'
       
    49 
       
    50 cat <<EOF >> $HGRCPATH
       
    51 [notify]
       
    52 config = $HGTMP/.notify.conf
       
    53 domain = test.com
       
    54 strip = 3
       
    55 template = Subject: {desc|firstline|strip}\nFrom: {author}\nX-Test: foo\n\nchangeset {node|short} in {webroot}\ndescription:\n\t{desc|tabindent|strip}
       
    56 
       
    57 [web]
       
    58 baseurl = http://test/
       
    59 EOF
       
    60 
       
    61 echo % fail for config file is missing
       
    62 hg --cwd b rollback
       
    63 hg --cwd b pull ../a 2>&1 | grep 'error.*\.notify\.conf' > /dev/null && echo pull failed
       
    64 
       
    65 touch "$HGTMP/.notify.conf"
       
    66 
       
    67 echo % pull
       
    68 hg --cwd b rollback
       
    69 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
       
    70   -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
       
    71   -e 's/^Date:.*/Date:/'
       
    72 
       
    73 cat << EOF >> $HGRCPATH
       
    74 [hooks]
       
    75 incoming.notify = python:hgext.notify.hook
       
    76 
       
    77 [notify]
       
    78 sources = pull
       
    79 diffstat = True
       
    80 EOF
       
    81 
       
    82 echo % pull
       
    83 hg --cwd b rollback
       
    84 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
       
    85   -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
       
    86   -e 's/^Date:.*/Date:/'
       
    87 
       
    88 echo % test merge
       
    89 cd a
       
    90 hg up -C 0
       
    91 echo a >> a
       
    92 hg ci -Am adda2 -d '2 0'
       
    93 hg merge
       
    94 hg ci -m merge -d '3 0'
       
    95 cd ..
       
    96 
       
    97 hg --traceback --cwd b pull ../a 2>&1 | sed -e 's/\(Message-Id:\).*/\1/' \
       
    98   -e 's/changeset \([0-9a-f]*\) in .*/changeset \1/' \
       
    99   -e 's/^Date:.*/Date:/'
       
   100