[PATCH stable] rollback: read dirstate branch with correct encoding

Sune Foldager cryo at cyanite.org
Tue Aug 14 08:41:27 CDT 2012


# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1344951206 -7200
# Branch stable
# Node ID 5e3d883950b7de8bbf6826d3f6bd9cf022838417
# Parent  bde1185f406cd2367e3973d827a6d613fd68ec60
rollback: read dirstate branch with correct encoding

diff -r bde1185f406c -r 5e3d883950b7 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Aug 02 19:10:45 2012 +0400
+++ b/mercurial/localrepo.py	Tue Aug 14 15:33:26 2012 +0200
@@ -1009,7 +1009,7 @@
             util.rename(self.join('undo.dirstate'), self.join('dirstate'))
             try:
                 branch = self.opener.read('undo.branch')
-                self.dirstate.setbranch(branch)
+                self.dirstate.setbranch(encoding.tolocal(branch))
             except IOError:
                 ui.warn(_('named branch could not be reset: '
                           'current branch is still \'%s\'\n')
diff -r bde1185f406c -r 5e3d883950b7 tests/test-encoding.t
--- a/tests/test-encoding.t	Thu Aug 02 19:10:45 2012 +0400
+++ b/tests/test-encoding.t	Tue Aug 14 15:33:26 2012 +0200
@@ -44,6 +44,10 @@
   marked working directory as branch \xe9 (esc)
   (branches are permanent and global, did you want a bookmark?)
   $ HGENCODING=latin-1 hg ci -m 'latin1 branch'
+  $ hg -q rollback
+  $ HGENCODING=latin-1 hg branch
+  \xe9 (esc)
+  $ HGENCODING=latin-1 hg ci -m 'latin1 branch'
   $ rm .hg/branch
 
 hg log (ascii)


More information about the Mercurial-devel mailing list