changeset 3824:3674ca805a5b

log: convert branch names to the local encoding
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Dec 2006 01:36:50 -0200
parents b3b868113d24
children ed5a9b27bedc
files mercurial/cmdutil.py tests/test-encoding tests/test-encoding.out
diffstat 3 files changed, 41 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -261,6 +261,7 @@ class changeset_printer(object):
         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 @@ class changeset_templater(changeset_prin
         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
+++ b/tests/test-encoding
@@ -25,6 +25,9 @@ echo "utf-8" > a
 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 @@ echo % latin-1
 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
+++ b/tests/test-encoding.out
@@ -15,8 +15,14 @@ transaction abort!
 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 @@ date:        Thu Jan 01 00:00:00 1970 +0
 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 @@ date:        Thu Jan 01 00:00:00 1970 +0
 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 @@ date:        Thu Jan 01 00:00:00 1970 +0
 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