REGRESSION in 0.17rc1, doing commit of files with unicode names.
Aaron Bentley
aaron.bentley at utoronto.ca
Mon Jun 18 00:27:09 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
The recent commit optimization replaces trace.note with just writing to
sys.stderr. But sys.stderr only accepts bytestrings, while trace.note
accepts unicode.
The result is that files with unicode names cannot be added and
committed (and most likely cannot be committed at all).
Here's how to reproduce the problem:
$ bzr init international
$ cd international/
$ ls
$ python
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open(u'\u1234', 'wb')
>>> f.write('1234')
>>> f.close()
>>>
abentley at lappy:~/sandbox/international$ ls
ሴ
abentley at lappy:~/sandbox/international$ bzr add
added "ሴ"
abentley at lappy:~/sandbox/international$ bzr commit -m "1234"
bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode
character u'\u1234' in position 6: ordinal not in range(128)
Traceback (most recent call last):
File "/home/abentley/bzr/bzr.dev/bzrlib/commands.py", line 717, in
run_bzr_catch_errors
return run_bzr(argv)
File "/home/abentley/bzr/bzr.dev/bzrlib/commands.py", line 678, in run_bzr
ret = run(*run_argv)
File "/home/abentley/bzr/bzr.dev/bzrlib/commands.py", line 375, in
run_argv_aliases
return self.run(**all_cmd_args)
File "/home/abentley/bzr/bzr.dev/bzrlib/builtins.py", line 2226, in run
reporter=reporter, revprops=properties)
File "/home/abentley/bzr/bzr.dev/bzrlib/decorators.py", line 165, in
write_locked
return unbound(self, *args, **kwargs)
File "/home/abentley/bzr/bzr.dev/bzrlib/workingtree_4.py", line 245,
in commit
result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
File "/home/abentley/bzr/bzr.dev/bzrlib/decorators.py", line 165, in
write_locked
return unbound(self, *args, **kwargs)
File "/home/abentley/bzr/bzr.dev/bzrlib/mutabletree.py", line 195, in
commit
revprops=revprops, *args, **kwargs)
File "/home/abentley/bzr/bzr.dev/bzrlib/commit.py", line 299, in commit
self._populate_new_inv()
File "/home/abentley/bzr/bzr.dev/bzrlib/commit.py", line 677, in
_populate_new_inv
self.reporter.snapshot_change(change, path)
File "/home/abentley/bzr/bzr.dev/bzrlib/commit.py", line 127, in
snapshot_change
self._note("%s %s", change, path)
File "/home/abentley/bzr/bzr.dev/bzrlib/commit.py", line 120, in _note
sys.stderr.write((format + "\n") % args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u1234' in
position 6: ordinal not in range(128)
bzr 0.18.0dev0 on python 2.5.1.final.0 (linux2)
arguments: ['/home/abentley/bin/bzr', 'commit', '-m', '1234']
** please send this report to bazaar at lists.ubuntu.com
I edited commit.py like this:
v$ bzr diff
=== modified file 'bzrlib/commit.py'
- --- bzrlib/commit.py 2007-06-06 05:56:03 +0000
+++ bzrlib/commit.py 2007-06-17 23:16:30 +0000
@@ -117,7 +117,7 @@
of its potential impact on performance.
"""
bzrlib.ui.ui_factory.clear_term()
- - sys.stderr.write((format + "\n") % args)
+ note((format + "\n") % args)
def snapshot_change(self, change, path):
if change == 'unchanged':
I was then able to commit.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGdcNN0F+nu1YWqI0RAtNHAJ0ROQdkJZXgr/LHMbrkRT+JxxO3aACeLJRX
VeZ2rB4QlyqBjOobp/rHClM=
=FCIA
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list