Mercurial > hg-stable
changeset 9880:a1886801d466
merge with crew-stable
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 18 Nov 2009 17:09:00 +0100 |
parents | d266aa7606ce (current diff) 7bb004fc14ec (diff) |
children | 54b518fc6671 |
files | |
diffstat | 4 files changed, 51 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/httprepo.py Wed Nov 18 00:19:42 2009 +0100 +++ b/mercurial/httprepo.py Wed Nov 18 17:09:00 2009 +0100 @@ -154,10 +154,13 @@ for branchpart in d.splitlines(): branchheads = branchpart.split(' ') branchname = urllib.unquote(branchheads[0]) + # Earlier servers (1.3.x) send branch names in (their) local + # charset. The best we can do is assume it's identical to our + # own local charset, in case it's not utf-8. try: - branchname.decode('utf-8', 'strict') + branchname.decode('utf-8') except UnicodeDecodeError: - branchname = encoding.tolocal(branchname) + branchname = encoding.fromlocal(branchname) branchheads = [bin(x) for x in branchheads[1:]] branchmap[branchname] = branchheads return branchmap
--- a/mercurial/sshrepo.py Wed Nov 18 00:19:42 2009 +0100 +++ b/mercurial/sshrepo.py Wed Nov 18 17:09:00 2009 +0100 @@ -173,10 +173,13 @@ for branchpart in d.splitlines(): branchheads = branchpart.split(' ') branchname = urllib.unquote(branchheads[0]) + # Earlier servers (1.3.x) send branch names in (their) local + # charset. The best we can do is assume it's identical to our + # own local charset, in case it's not utf-8. try: - branchname.decode('utf-8', 'strict') + branchname.decode('utf-8') except UnicodeDecodeError: - branchname = encoding.tolocal(branchname) + branchname = encoding.fromlocal(branchname) branchheads = [bin(x) for x in branchheads[1:]] branchmap[branchname] = branchheads return branchmap
--- a/tests/test-branchmap Wed Nov 18 00:19:42 2009 +0100 +++ b/tests/test-branchmap Wed Nov 18 17:09:00 2009 +0100 @@ -21,3 +21,38 @@ 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
--- a/tests/test-branchmap.out Wed Nov 18 00:19:42 2009 +0100 +++ b/tests/test-branchmap.out Wed Nov 18 17:09:00 2009 +0100 @@ -34,3 +34,9 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: foo +pushing to ssh://dummy/ +searching for changes +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files