# HG changeset patch # User Henrik Stuart # Date 2009-11-16 12:35:36 # Node ID 0262bb59016f5e09843931593ba9272460855a4c # Parent 9c43089b372a3154d7152222c634111ee0c0ee17 support encoding fallback in branchmap to maintain compatibility with 1.3.x diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -11,6 +11,7 @@ from i18n import _ import repo, changegroup, statichttprepo, error, url, util import os, urllib, urllib2, urlparse, zlib, httplib import errno, socket +import encoding def zgenerator(f): zd = zlib.decompressobj() @@ -153,6 +154,10 @@ class httprepository(repo.repository): for branchpart in d.splitlines(): branchheads = branchpart.split(' ') branchname = urllib.unquote(branchheads[0]) + try: + branchname.decode('utf-8', 'strict') + except UnicodeDecodeError: + branchname = encoding.tolocal(branchname) branchheads = [bin(x) for x in branchheads[1:]] branchmap[branchname] = branchheads return branchmap diff --git a/mercurial/sshrepo.py b/mercurial/sshrepo.py --- a/mercurial/sshrepo.py +++ b/mercurial/sshrepo.py @@ -7,7 +7,7 @@ from node import bin, hex from i18n import _ -import repo, util, error +import repo, util, error, encoding import re, urllib class remotelock(object): @@ -173,6 +173,10 @@ class sshrepository(repo.repository): for branchpart in d.splitlines(): branchheads = branchpart.split(' ') branchname = urllib.unquote(branchheads[0]) + try: + branchname.decode('utf-8', 'strict') + except UnicodeDecodeError: + branchname = encoding.tolocal(branchname) branchheads = [bin(x) for x in branchheads[1:]] branchmap[branchname] = branchheads return branchmap