--- a/mercurial/hg.py Mon Jun 07 16:28:23 2010 +0200
+++ b/mercurial/hg.py Tue Jun 08 13:19:22 2010 +0200
@@ -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 Mon Jun 07 16:28:23 2010 +0200
+++ b/tests/test-branch-option Tue Jun 08 13:19:22 2010 +0200
@@ -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 Mon Jun 07 16:28:23 2010 +0200
+++ b/tests/test-branch-option.out Tue Jun 08 13:19:22 2010 +0200
@@ -13,6 +13,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
created new head
in rev c branch a
@@ -22,9 +28,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