diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1009,7 +1009,7 @@ class localrepository(object): util.rename(self.join('undo.dirstate'), self.join('dirstate')) try: branch = self.opener.read('undo.branch') - self.dirstate.setbranch(branch) + self.dirstate.setbranch(encoding.tolocal(branch)) except IOError: ui.warn(_('named branch could not be reset: ' 'current branch is still \'%s\'\n') diff --git a/tests/test-encoding.t b/tests/test-encoding.t --- a/tests/test-encoding.t +++ b/tests/test-encoding.t @@ -44,6 +44,10 @@ these should work marked working directory as branch \xe9 (esc) (branches are permanent and global, did you want a bookmark?) $ HGENCODING=latin-1 hg ci -m 'latin1 branch' + $ hg -q rollback + $ HGENCODING=latin-1 hg branch + \xe9 (esc) + $ HGENCODING=latin-1 hg ci -m 'latin1 branch' $ rm .hg/branch hg log (ascii)