hgext/bookmarks.py
changeset 13048 e298cca2d53a
parent 13032 e41e2b79883d
child 13050 3790452d499b
--- a/hgext/bookmarks.py	Wed Nov 24 15:56:32 2010 -0600
+++ b/hgext/bookmarks.py	Wed Nov 24 16:04:33 2010 -0600
@@ -31,7 +31,7 @@
 from mercurial.i18n import _
 from mercurial.node import nullid, nullrev, bin, hex, short
 from mercurial import util, commands, repair, extensions, pushkey, hg, url
-from mercurial import revset
+from mercurial import revset, encoding
 import os
 
 def write(repo):
@@ -52,7 +52,7 @@
     try:
         file = repo.opener('bookmarks', 'w', atomictemp=True)
         for refspec, node in refs.iteritems():
-            file.write("%s %s\n" % (hex(node), refspec))
+            file.write("%s %s\n" % (hex(node), encoding.fromlocal(refspec)))
         file.rename()
 
         # touch 00changelog.i so hgweb reloads bookmarks (no lock needed)
@@ -233,6 +233,7 @@
                 bookmarks = {}
                 for line in self.opener('bookmarks'):
                     sha, refspec = line.strip().split(' ', 1)
+                    refspec = encoding.tolocal(refspec)
                     bookmarks[refspec] = self.changelog.lookup(sha)
             except:
                 pass