changeset 3773:b1eeaeb936ae

Handle transcoding of branch names
author Matt Mackall <mpm@selenic.com>
date Sun, 03 Dec 2006 16:16:33 -0600
parents 73860ffbe798
children a88e02081a88
files mercurial/commands.py mercurial/localrepo.py mercurial/merge.py
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Dec 03 16:16:33 2006 -0600
+++ b/mercurial/commands.py	Sun Dec 03 16:16:33 2006 -0600
@@ -273,7 +273,9 @@
         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
--- a/mercurial/localrepo.py	Sun Dec 03 16:16:33 2006 -0600
+++ b/mercurial/localrepo.py	Sun Dec 03 16:16:33 2006 -0600
@@ -322,7 +322,10 @@
             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 @@
         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"))
--- a/mercurial/merge.py	Sun Dec 03 16:16:33 2006 -0600
+++ b/mercurial/merge.py	Sun Dec 03 16:16:33 2006 -0600
@@ -477,6 +477,7 @@
         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