log: convert branch names to the local encoding
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 08 Dec 2006 01:36:50 -0200
changeset 3827 3674ca805a5b
parent 3826 b3b868113d24
child 3828 ed5a9b27bedc
log: convert branch names to the local encoding
mercurial/cmdutil.py
tests/test-encoding
tests/test-encoding.out
--- a/mercurial/cmdutil.py	Thu Dec 07 14:35:43 2006 -0200
+++ b/mercurial/cmdutil.py	Fri Dec 08 01:36:50 2006 -0200
@@ -261,6 +261,7 @@
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
         if branch:
+            branch = util.tolocal(branch)
             self.ui.write(_("branch:      %s\n") % branch)
         for tag in self.repo.nodetags(changenode):
             self.ui.write(_("tag:         %s\n") % tag)
@@ -404,6 +405,7 @@
         def showbranches(**args):
             branch = changes[5].get("branch")
             if branch:
+                branch = util.tolocal(branch)
                 return showlist('branch', [branch], plural='branches', **args)
             # add old style branches if requested
             if self.brinfo:
--- a/tests/test-encoding	Thu Dec 07 14:35:43 2006 -0200
+++ b/tests/test-encoding	Fri Dec 08 01:36:50 2006 -0200
@@ -25,6 +25,9 @@
 HGENCODING=utf-8 hg ci -l utf-8 -d "0 0"
 
 HGENCODING=latin-1 hg tag -d "0 0" `cat latin-1-tag`
+cp latin-1-tag .hg/branch
+HGENCODING=latin-1 hg ci -d "0 0" -m 'latin1 branch'
+rm .hg/branch
 
 echo % ascii
 hg --encoding ascii log
@@ -38,3 +41,9 @@
 HGENCODING=latin-1 hg tags
 echo % utf-8
 HGENCODING=utf-8 hg tags
+echo % ascii
+HGENCODING=ascii hg branches
+echo % latin-1
+HGENCODING=latin-1 hg branches
+echo % utf-8
+HGENCODING=utf-8 hg branches
--- a/tests/test-encoding.out	Thu Dec 07 14:35:43 2006 -0200
+++ b/tests/test-encoding.out	Fri Dec 08 01:36:50 2006 -0200
@@ -15,8 +15,14 @@
 rollback completed
 % these should work
 % ascii
+changeset:   4:d8a5d9eaf41e
+branch:      ?
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     latin1 branch
+
 changeset:   3:5edfc7acb541
-tag:         tip
 user:        test
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     Added tag ? for changeset 91878608adb3
@@ -38,8 +44,14 @@
 summary:     latin-1 e': ?
 
 % latin-1
+changeset:   4:d8a5d9eaf41e
+branch:      é
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     latin1 branch
+
 changeset:   3:5edfc7acb541
-tag:         tip
 user:        test
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     Added tag é for changeset 91878608adb3
@@ -61,8 +73,14 @@
 summary:     latin-1 e': é
 
 % utf-8
+changeset:   4:d8a5d9eaf41e
+branch:      é
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     latin1 branch
+
 changeset:   3:5edfc7acb541
-tag:         tip
 user:        test
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     Added tag é for changeset 91878608adb3
@@ -84,11 +102,17 @@
 summary:     latin-1 e': é
 
 % ascii
-tip                                3:5edfc7acb541
+tip                                4:d8a5d9eaf41e
 ?                                  2:91878608adb3
 % latin-1
-tip                                3:5edfc7acb541
+tip                                4:d8a5d9eaf41e
 é                                  2:91878608adb3
 % utf-8
-tip                                3:5edfc7acb541
+tip                                4:d8a5d9eaf41e
 é                                  2:91878608adb3
+% ascii
+?                              4:d8a5d9eaf41e
+% latin-1
+é                              4:d8a5d9eaf41e
+% utf-8
+é                              4:d8a5d9eaf41e