--- a/mercurial/hg.py Tue Jun 08 15:52:56 2010 -0500
+++ b/mercurial/hg.py Tue Jun 08 15:57:59 2010 -0500
@@ -30,8 +30,10 @@
if branch == '.':
if not lrepo or not lrepo.local():
raise util.Abort(_("dirstate branch not accessible"))
- branch = lrepo.dirstate.branch()
- butf8 = encoding.fromlocal(branch)
+ butf8 = lrepo.dirstate.branch()
+ branch = encoding.tolocal(butf8)
+ else:
+ butf8 = encoding.fromlocal(branch)
if butf8 in branchmap:
revs.extend(node.hex(r) for r in reversed(branchmap[butf8]))
else:
--- a/tests/test-branch-option Tue Jun 08 15:52:56 2010 -0500
+++ b/tests/test-branch-option Tue Jun 08 15:57:59 2010 -0500
@@ -20,6 +20,14 @@
echo b > foo
hg ci -d '0 0' -mb
hg up 0
+hg --encoding utf-8 branch æ
+echo ae1 > foo
+hg ci -d '0 0' -mae1
+hg up 0
+hg --encoding utf-8 branch -f æ
+echo ae2 > foo
+hg ci -d '0 0' -mae2
+hg up 0
hg branch -f b
echo b2 > foo
hg ci -d '0 0' -mb2
@@ -30,6 +38,10 @@
echo out branch .
hg out -q ../branch#.
hg out -q -b .
+echo out branch . non-ascii
+hg --encoding utf-8 up æ
+hg --encoding latin1 out -q ../branch#.
+hg --encoding latin1 out -q -b .
echo clone branch b
cd ..
hg clone branch2#b branch3
--- a/tests/test-branch-option.out Tue Jun 08 15:52:56 2010 -0500
+++ b/tests/test-branch-option.out Tue Jun 08 15:57:59 2010 -0500
@@ -12,6 +12,12 @@
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+marked working directory as branch æ
+created new head
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+marked working directory as branch æ
+created new head
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
marked working directory as branch b
in rev c branch a
1:dd6e60a716c6
@@ -20,9 +26,15 @@
2:f25d57ab0566
out branch .
1:b84708d77ab7
-2:65511d0e2b55
+4:65511d0e2b55
1:b84708d77ab7
-2:65511d0e2b55
+4:65511d0e2b55
+out branch . non-ascii
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+2:df5a44224d4e
+3:4f4a5125ca10
+2:df5a44224d4e
+3:4f4a5125ca10
clone branch b
requesting all changes
adding changesets