# HG changeset patch # User LUO Zheng # Date 2011-06-08 13:25:18 # Node ID e29821ca94cfdc800a47a0bac38e2931a6b5dede # Parent 2ce7dfe17bc543415d11b316af3f0c949aa28e41 bookmarks: recognize the current bookmark when the local encoding isn't UTF-8 The current bookmark is stored in bookmark.current, supposingly in UTF-8. But the call to encoding.fromlocal() is missing, therefore Hg is not able to recognize the current bookmark in the case that bookmark uses characters of which the bit stream is different between local encoding and UTF-8. For example, the Chinese version of Windows cmd uses gbk(cp936), not UTF-8. Therefore I won't be able to make a Chinese bookmark current. By wrapping mark in a encoding.fromlocal() call, the problem is solved. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -114,7 +114,7 @@ def setcurrent(repo, mark): wlock = repo.wlock() try: file = repo.opener('bookmarks.current', 'w', atomictemp=True) - file.write(mark) + file.write(encoding.fromlocal(mark)) file.rename() finally: wlock.release()