tests/test-branchmap
author Mads Kiilerich <mads@kiilerich.com>
Tue, 29 Jun 2010 12:12:34 +0200
branchstable
changeset 11488 f786fc4b8764
parent 9879 7bb004fc14ec
permissions -rwxr-xr-x
log: follow filenames through renames (issue647) In commands.log a displayer was initialized from cmdutil.show_changeset() with the initial matchfn (which designates the specified files which only is correct in the highest revision in the range). prep() is handed the correct list of files, but displayer.show() didn't use that list but keept using the original matchfn. The matchfn argument to cmdutil.show_changeset() wasn't specified in other places and is only used in .show(), so now we give the matchfn as an optional parameter to .show(). We do however still have to detect --patch and --stat from opts in show_changeset() and let it imply a matchall, but that can now be overruled with the new .show() matchfn parameter.

#!/bin/sh

hgserve()
{
    hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ \
        | sed -e 's/:[0-9][0-9]*//g' -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
    cat hg.pid >> "$DAEMON_PIDS"
}

hg init a
hg --encoding utf-8 -R a branch æ
echo foo > a/foo
hg -R a ci -Am foo

hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
hg --encoding utf-8 clone http://localhost:$HGPORT1 b
hg --encoding utf-8 -R b log
echo bar >> b/foo
hg -R b ci -m bar
hg --encoding utf-8 -R b push | sed "s/$HGPORT1/PORT/"
hg -R a --encoding utf-8 log

kill `cat hg.pid`


# verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)

cat <<EOF > oldhg
import sys
from mercurial import ui, hg, commands

class StdoutWrapper(object):
    def __init__(self, stdout):
        self._file = stdout

    def write(self, data):
        if data == '47\n':
            # latin1 encoding is one %xx (3 bytes) shorter
            data = '44\n'
        elif data.startswith('%C3%A6 '):
            # translate to latin1 encoding
            data = '%%E6 %s' % data[7:]
        self._file.write(data)

    def __getattr__(self, name):
        return getattr(self._file, name)

sys.stdout = StdoutWrapper(sys.stdout)
sys.stderr = StdoutWrapper(sys.stderr)

myui = ui.ui()
repo = hg.repository(myui, 'a')
commands.serve(myui, repo, stdio=True)
EOF

echo baz >> b/foo
hg -R b ci -m baz
hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1