tests/test-branchmap
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 30 Jun 2010 13:03:48 +0900
branchstable
changeset 11482 fa19c7418f83
parent 9879 7bb004fc14ec
permissions -rwxr-xr-x
i18n-ja: synchronized with 13d02d6677f2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9671
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     1
#!/bin/sh
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     2
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     3
hgserve()
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     4
{
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     5
    hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ \
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     6
        | sed -e 's/:[0-9][0-9]*//g' -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     7
    cat hg.pid >> "$DAEMON_PIDS"
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     8
}
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
     9
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    10
hg init a
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    11
hg --encoding utf-8 -R a branch æ
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    12
echo foo > a/foo
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    13
hg -R a ci -Am foo
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    14
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    15
hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
9789
79e749b26b2b Use utf-8 encoding in test-branchmap's clone call
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9671
diff changeset
    16
hg --encoding utf-8 clone http://localhost:$HGPORT1 b
9671
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    17
hg --encoding utf-8 -R b log
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    18
echo bar >> b/foo
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    19
hg -R b ci -m bar
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    20
hg --encoding utf-8 -R b push | sed "s/$HGPORT1/PORT/"
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    21
hg -R a --encoding utf-8 log
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    22
9471d9a900b4 transfer branchmap branch names over the wire in utf-8
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
diff changeset
    23
kill `cat hg.pid`
9879
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    24
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    25
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    26
# verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    27
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    28
cat <<EOF > oldhg
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    29
import sys
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    30
from mercurial import ui, hg, commands
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    31
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    32
class StdoutWrapper(object):
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    33
    def __init__(self, stdout):
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    34
        self._file = stdout
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    35
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    36
    def write(self, data):
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    37
        if data == '47\n':
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    38
            # latin1 encoding is one %xx (3 bytes) shorter
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    39
            data = '44\n'
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    40
        elif data.startswith('%C3%A6 '):
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    41
            # translate to latin1 encoding
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    42
            data = '%%E6 %s' % data[7:]
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    43
        self._file.write(data)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    44
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    45
    def __getattr__(self, name):
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    46
        return getattr(self._file, name)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    47
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    48
sys.stdout = StdoutWrapper(sys.stdout)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    49
sys.stderr = StdoutWrapper(sys.stderr)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    50
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    51
myui = ui.ui()
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    52
repo = hg.repository(myui, 'a')
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    53
commands.serve(myui, repo, stdio=True)
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    54
EOF
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    55
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    56
echo baz >> b/foo
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    57
hg -R b ci -m baz
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    58
hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1