Rev 5205: (Parth Malwankar) Bug #529930, aliases are stored in UTF-8 config, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue May 4 23:02:17 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5205 [merge]
revision-id: pqm at pqm.ubuntu.com-20100504220205-wonry54yq4jeu1b2
parent: pqm at pqm.ubuntu.com-20100504185054-jhfzap78g3lxtj7u
parent: parth.malwankar at gmail.com-20100429033442-tpbb6l4pmh91u00l
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-05-04 23:02:05 +0100
message:
(Parth Malwankar) Bug #529930, aliases are stored in UTF-8 config,
don't decode them in user_encoding.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/tests/blackbox/test_alias.py test_alias.py-20080425112253-fbt0yz1c1834jriz-1
=== modified file 'NEWS'
--- a/NEWS 2010-05-04 17:32:48 +0000
+++ b/NEWS 2010-05-04 22:02:05 +0000
@@ -69,6 +69,9 @@
more comprehensible.
(Martin Pool, #491763)
+* Unicode characters in aliases are now handled correctly and do not cause
+ UnicodeEncodeError exception. (Parth Malwankar, #529930)
+
Improvements
************
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2010-04-16 07:56:51 +0000
+++ b/bzrlib/commands.py 2010-04-28 13:03:47 +0000
@@ -1077,15 +1077,9 @@
if not opt_no_aliases:
alias_argv = get_alias(argv[0])
if alias_argv:
- user_encoding = osutils.get_user_encoding()
- alias_argv = [a.decode(user_encoding) for a in alias_argv]
argv[0] = alias_argv.pop(0)
cmd = argv.pop(0)
- # We want only 'ascii' command names, but the user may have typed
- # in a Unicode name. In that case, they should just get a
- # 'command not found' error later.
-
cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
run = cmd_obj.run_argv_aliases
run_argv = [argv, alias_argv]
=== modified file 'bzrlib/tests/blackbox/test_alias.py'
--- a/bzrlib/tests/blackbox/test_alias.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_alias.py 2010-04-29 03:23:18 +0000
@@ -16,8 +16,11 @@
#
"""Tests of the 'bzr alias' command."""
+import os
+import codecs
from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.config import (ensure_config_dir_exists, config_filename)
class TestAlias(ExternalBase):
@@ -41,6 +44,26 @@
out, err = self.run_bzr('alias commit')
self.assertEquals('bzr alias commit="commit --strict"\n', out)
+ def test_unicode_alias(self):
+ """Unicode aliases should work (Bug #529930)"""
+ config_enc = 'utf-8'
+ file_name = u'foo\xb6'
+
+ tree = self.make_branch_and_tree('.')
+ self.build_tree([file_name])
+ tree.add(file_name)
+ tree.commit('added')
+
+ ensure_config_dir_exists()
+ CONFIG=(u'[ALIASES]\n'
+ u'ust=st foo\xb6\n')
+
+ codecs.open(config_filename(),'w', config_enc).write(CONFIG)
+
+ out, err = self.run_bzr('ust')
+ self.assertEquals(err, '')
+ self.assertEquals(out, '')
+
def test_alias_listing_alphabetical(self):
self.run_bzr('alias commit="commit --strict"')
self.run_bzr('alias ll="log --short"')
More information about the bazaar-commits
mailing list