Mercurial > hg
changeset 13048:e298cca2d53a
bookmarks: use UTF-8 storage
This uses tolocal/fromlocal to translate bookmark metadata to UTF-8
for storage. Existing bookmarks in ASCII, UTF-8 or Latin1 will
continue to work, others may need to set HGENCODINGFALLBACK to
transition.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 24 Nov 2010 16:04:33 -0600 |
parents | 6c375e07d673 |
children | d588326f6321 |
files | hgext/bookmarks.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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