hgrepo: ensure all git-origin tags are bytes

If we don't do this we might end up with unicodes being written using
ui, which then breaks in popbuffer in test-encoding.t. This appears to
be an academic concern until we start passing unicode paths to git
repos, which we need to do in order to resolve some other problems. Yay.
This commit is contained in:
Augie Fackler 2015-12-31 18:48:01 -05:00
parent 1c80236266
commit 1695f5ea63

View File

@ -45,9 +45,15 @@ def generate_repo_subclass(baseclass):
(tags, tagtypes) = super(hgrepo, self)._findtags()
for tag, rev in self.githandler.tags.iteritems():
if isinstance(tag, unicode):
tag = tag.encode('utf-8')
tags[tag] = bin(rev)
tagtypes[tag] = 'git'
for tag, rev in self.githandler.remote_refs.iteritems():
if isinstance(tag, unicode):
tag = tag.encode('utf-8')
tags[tag] = rev
tagtypes[tag] = 'git-remote'
tags.update(self.githandler.remote_refs)
return (tags, tagtypes)