Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httprepo.py @ 9861:0262bb59016f
support encoding fallback in branchmap to maintain compatibility with 1.3.x
author | Henrik Stuart <henrik.stuart@edlund.dk> |
---|---|
date | Mon, 16 Nov 2009 13:35:36 +0100 |
parents | 67e5d5a2f625 |
children | 7e7d56fe4833 |
line wrap: on
line diff
--- a/mercurial/httprepo.py Mon Nov 16 14:09:31 2009 +0100 +++ b/mercurial/httprepo.py Mon Nov 16 13:35:36 2009 +0100 @@ -11,6 +11,7 @@ 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 @@ 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