# HG changeset patch # User Matt Mackall # Date 1165184193 21600 # Node ID b1eeaeb936ae8b77b72f217f6885425926639b16 # Parent 73860ffbe798901b1da5826fc8803eafd82fcc63 Handle transcoding of branch names diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -273,7 +273,9 @@ def branches(ui, repo): if ui.quiet: ui.write("%s\n" % t) else: - ui.write("%-30s %s:%s\n" % (t, -r, hexfunc(n))) + t = util.localsub(t, 30) + t += " " * (30 - util.locallen(t)) + ui.write("%s %s:%s\n" % (t, -r, hexfunc(n))) def bundle(ui, repo, fname, dest=None, **opts): """create a changegroup file diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -322,7 +322,10 @@ class localrepository(repo.repository): self._updatebranchcache(partial, lrev+1, tiprev+1) self._writebranchcache(partial, self.changelog.tip(), tiprev) - self.branchcache = partial + # the branch cache is stored on disk as UTF-8, but in the local + # charset internally + for k, v in partial.items(): + self.branchcache[util.tolocal(k)] = v return self.branchcache def _readbranchcache(self): @@ -633,12 +636,12 @@ class localrepository(repo.repository): m2 = self.manifest.read(c2[0]) if use_dirstate: - branchname = self.workingctx().branch() + branchname = util.fromlocal(self.workingctx().branch()) else: branchname = "" if use_dirstate: - oldname = c1[5].get("branch", "") + oldname = c1[5].get("branch", "") # stored in UTF-8 if not commit and not remove and not force and p2 == nullid and \ branchname == oldname: self.ui.status(_("nothing changed\n")) diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -477,6 +477,7 @@ def update(repo, node, branchmerge, forc repo.dirstate.setparents(fp1, fp2) repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3]) if not branchmerge: + b = util.tolocal(p2.branch()) repo.opener("branch", "w").write(p2.branch() + "\n") return stats