tests/test-patchbomb
author Matt Mackall <mpm@selenic.com>
Fri, 07 Nov 2008 16:28:52 -0600
changeset 7343 e47dab64be8d
parent 7265 0cf3442ee844
child 7357 6eb38b2dca6c
permissions -rwxr-xr-x
run-tests: allow turning off diff display
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/' \
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     7
        -e 's/===.*/===/'
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     8
}
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
     9
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    10
echo "[extensions]" >> $HGRCPATH
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    11
echo "patchbomb=" >> $HGRCPATH
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    12
5753
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    13
hg init t
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    14
cd t
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    15
echo a > a
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    16
hg commit -Ama -d '1 0'
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    17
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    18
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
    19
  fixheaders
4420
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    20
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    21
echo b > b
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    22
hg commit -Amb -d '2 0'
b0656b33cc02 add test for patchbomb extension.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    23
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    24
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
    25
  fixheaders
4565
1cf908c00479 Don't validate email config if we're not sending email.
Bryan O'Sullivan <bos@serpentine.com>
parents: 4420
diff changeset
    26
4567
8b87bd4fb7ce Correct tests/test-patchbomb* files:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4566
diff changeset
    27
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
    28
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    29
cd ..
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    30
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    31
hg clone -q t t2
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    32
cd t2
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    33
echo c > c
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    34
hg commit -Amc -d '3 0'
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    35
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    36
cat > description <<EOF
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    37
a multiline
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    38
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    39
description
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    40
EOF
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    41
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    42
echo % test bundle and description
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    43
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
    44
    -c bar -s test -r tip -b --desc description | \
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    45
    fixheaders
ea1016b32e94 patchbomb: make --bundle respect --desc
Patrick Mezard <pmezard@gmail.com>
parents: 4597
diff changeset
    46
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    47
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
    48
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
    49
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
    50
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    51
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
    52
hg email --date '1970-1-1 0:4' -f quux -t foo -c bar -r tip -n | fixheaders > mailtest
7193
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    53
echo % md5sum of 8-bit output
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    54
$TESTDIR/md5sum.py mailtest
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    55
rm mailtest
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    56
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    57
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
    58
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
    59
cat mbox | fixheaders
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    60
rm mbox
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    61
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    62
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
    63
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
    64
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
    65
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    66
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
    67
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
    68
fixheaders < mbox > mboxfix
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    69
echo % md5sum of 8-bit output
12fc42c78598 mail: test patch mime encoding for patchbomb
Christian Ebert <blacktrash@gmx.net>
parents: 5753
diff changeset
    70
$TESTDIR/md5sum.py mboxfix