tests/test-patchbomb
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 28 Dec 2008 20:21:20 +0100
changeset 7545 55e997c8bf62
parent 7413 0b6428da1f22
child 7547 4949729ee9ee
permissions -rwxr-xr-x
merge with -stable
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     1
#!/bin/sh
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     2
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     3
fixheaders()
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     4
{
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     5
    sed -e 's/\(Message-Id:.*@\).*/\1/'  \
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     6
        -e 's/\(In-Reply-To:.*@\).*/\1/' \
7413
0b6428da1f22 email: add References field in the header
Benoit Allard <benoit@aeteurope.nl>
parents: 7360
diff changeset
     7
        -e 's/\(References:.*@\).*/\1/'  \
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     8
        -e 's/===.*/===/'
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     9
}
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    10
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    11
echo "[extensions]" >> $HGRCPATH
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    12
echo "patchbomb=" >> $HGRCPATH
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    13
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    14
hg init t
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    15
cd t
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    16
echo a > a
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    17
hg commit -Ama -d '1 0'
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    18
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    19
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar tip | \
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    20
  fixheaders
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    21
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    22
echo b > b
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    23
hg commit -Amb -d '2 0'
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    24
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    25
hg email --date '1970-1-1 0:2' -n -f quux -t foo -c bar -s test 0:tip | \
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    26
  fixheaders
4565
1cf908c00479 Don't validate email config if we're not sending email.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4420
diff changeset
    27
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    28
hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    29
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    30
cd ..
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    31
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    32
hg clone -q t t2
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    33
cd t2
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    34
echo c > c
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    35
hg commit -Amc -d '3 0'
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    36
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    37
cat > description <<EOF
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    38
a multiline
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    39
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    40
description
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    41
EOF
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    42
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    43
echo "% test bundle and description"
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    44
hg email --date '1970-1-1 0:3' -n -f quux -t foo \
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    45
    -c bar -s test -r tip -b --desc description | \
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    46
    fixheaders
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    47
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    48
echo "% utf-8 patch"
7265
0cf3442ee844 test-patchbomb: write in binary mode, force non-interactive mode (win32)
Patrick Mezard <pmezard@gmail.com>
parents: 7193
diff changeset
    49
python -c 'fp = open("utf", "wb"); fp.write("h\xC3\xB6mma!\n"); fp.close();'
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    50
hg commit -A -d '4 0' -m 'charset=utf-8; content-transfer-encoding: base64'
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    51
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    52
echo "% no mime encoding for email --test"
7265
0cf3442ee844 test-patchbomb: write in binary mode, force non-interactive mode (win32)
Patrick Mezard <pmezard@gmail.com>
parents: 7193
diff changeset
    53
hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -n | fixheaders > mailtest
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    54
echo "% md5sum of 8-bit output"
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    55
$TESTDIR/md5sum.py mailtest
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    56
rm mailtest
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    57
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    58
echo "% mime encoded mbox"
7265
0cf3442ee844 test-patchbomb: write in binary mode, force non-interactive mode (win32)
Patrick Mezard <pmezard@gmail.com>
parents: 7193
diff changeset
    59
hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -m mbox
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    60
cat mbox | fixheaders
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    61
rm mbox
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    62
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    63
echo "% iso-8859-1 patch"
7265
0cf3442ee844 test-patchbomb: write in binary mode, force non-interactive mode (win32)
Patrick Mezard <pmezard@gmail.com>
parents: 7193
diff changeset
    64
python -c 'fp = open("isolatin", "wb"); fp.write("h\xF6mma!\n"); fp.close();'
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    65
hg commit -A -d '5 0' -m 'charset=us-ascii; content-transfer-encoding: 8bit'
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    66
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    67
echo "% fake ascii mbox"
7265
0cf3442ee844 test-patchbomb: write in binary mode, force non-interactive mode (win32)
Patrick Mezard <pmezard@gmail.com>
parents: 7193
diff changeset
    68
hg email --date '1970-1-1 0:5' -f quux -t foo -c bar -r tip -m mbox
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    69
fixheaders < mbox > mboxfix
7357
6eb38b2dca6c patchbomb: make test markers more syntax highlighter friendly
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7265
diff changeset
    70
echo "% md5sum of 8-bit output"
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    71
$TESTDIR/md5sum.py mboxfix
7358
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    72
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    73
echo "% test diffstat for single patch"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    74
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -d -y 2 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    75
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    76
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    77
echo "% test diffstat for multiple patches"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    78
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -d -y 0:1 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    79
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    80
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    81
echo "% test inline for single patch"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    82
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -i 2 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    83
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    84
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    85
echo "% test inline for multiple patches"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    86
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -i 0:1 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    87
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    88
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    89
echo "% test attach for single patch"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    90
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -a 2 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    91
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    92
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    93
echo "% test attach for multiple patches"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    94
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -a 0:1 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    95
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
    96
7360
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
    97
echo "% test intro for single patch"
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
    98
hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 2 | \
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
    99
  fixheaders
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
   100
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
   101
echo "% test intro for multiple patches"
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
   102
hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 0:1 | \
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
   103
  fixheaders
42f1b8cb9a60 patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter <elwintro@gmail.com>
parents: 7358
diff changeset
   104
7358
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   105
echo "% tagging csets"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   106
hg tag -r0 zero zero.foo
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   107
hg tag -r1 one one.patch
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   108
hg tag -r2 two two.diff
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   109
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   110
echo "% test inline for single named patch"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   111
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -i 2 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   112
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   113
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   114
echo "% test inline for multiple named/unnamed patches"
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   115
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -i 0:1 | \
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   116
  fixheaders
3c2ed7c2dcb4 patchbomb: add tests for diffstat, inline, and attach options
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7357
diff changeset
   117