bazaarとbzr-svnと日本語
Windows XP
bazaar ver.1.13
python ver.2.5.2
bazaarで"表"という名前のフォルダは扱えるが、bzr-svnではエラーになる(という理解でよいのかな?)。
C:\work\testprj\repos3\repos>bzr add 表 adding "表" C:\work\testprj\repos3\repos>bzr ci Committing to: C:/work/testprj/repos3/repos/ added 表 Committed revision 551. C:\work\testprj\repos3\repos>bzr push file:///c:/repos/ C:/Program Files/Bazaar/plugins\svn\commit.py:370: UnicodeWarning: Unicode unequ al comparison failed to convert both arguments to Unicode - interpreting them as being unequal bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-11: ordinal not in range(128) Traceback (most recent call last): File "bzrlib\commands.pyo", line 716, in exception_to_return_code File "bzrlib\commands.pyo", line 911, in run_bzr File "bzrlib\commands.pyo", line 547, in run_argv_aliases File "bzrlib\builtins.pyo", line 1033, in run File "bzrlib\push.pyo", line 159, in _show_push_branch File "bzrlib\decorators.pyo", line 138, in read_locked File "bzrlib\branch.pyo", line 2071, in push File "bzrlib\branch.pyo", line 2757, in _run_with_write_locked_target File "bzrlib\branch.pyo", line 2110, in _push_with_bound_branches File "bzrlib\branch.pyo", line 2133, in _basic_push File "bzrlib\decorators.pyo", line 192, in write_locked File "C:/Program Files/Bazaar/plugins\svn\branch.py", line 482, in update_revi sions File "C:/Program Files/Bazaar/plugins\svn\branch.py", line 738, in update_revi sions File "C:/Program Files/Bazaar/plugins\svn\push.py", line 280, in push_branch File "C:/Program Files/Bazaar/plugins\svn\push.py", line 290, in push File "C:/Program Files/Bazaar/plugins\svn\push.py", line 236, in push File "C:/Program Files/Bazaar/plugins\svn\push.py", line 205, in push_revision _tree File "C:/Program Files/Bazaar/plugins\svn\errors.py", line 127, in convert File "C:/Program Files/Bazaar/plugins\svn\commit.py", line 758, in commit File "C:/Program Files/Bazaar/plugins\svn\commit.py", line 378, in dir_editor_ send_changes UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-11: ordi nal not in range(128) bzr 1.13 on python 2.5.2 (win32) arguments: ['bzr', 'push', 'file:///c:/repos/'] encoding: 'cp932', fsenc: 'mbcs', lang: None plugins: bzrtools C:\Program Files\Bazaar\plugins\bzrtools [1.13] launchpad C:\Program Files\Bazaar\plugins\launchpad [unknown] netrc_credential_store C:\Program Files\Bazaar\plugins\netrc_credential_store [unknown] qbzr C:\Program Files\Bazaar\plugins\qbzr [0.9.8] svn C:\Program Files\Bazaar\plugins\svn [0.5.3] *** Bazaar has encountered an internal error. Please report a bug at https://bugs.launchpad.net/bzr/+filebug including this traceback, and a description of what you were doing when the error occurred.
とりあえず、bzr-svn ver.0.5.3を以下のように変更すると上記エラーは出なくなった。
--- C:/work/bzr-svn-0.5.3/commit.py Tue Mar 10 22:31:14 2009 +++ C:/work/bzr-svn-0.5.3mod/commit.py Sun Apr 26 03:17:46 2009 @@ -342,7 +342,7 @@ if child_ie.kind != 'directory': continue - new_child_path = new_inv.id2path(child_ie.file_id) + new_child_path = new_inv.id2path(child_ie.file_id).encode("utf-8") # add them if they didn't exist in base_inv or changed kind if (not child_ie.file_id in base_inv or base_inv[child_ie.file_id].kind != child_ie.kind):
また、日本語ファイル名でコンフリクトが発生した場合に、エラーでコマンドが実行できないこともあった。
これは、bazaar本体の以下の改変で回避した(適切かどうかはわからないが)。
--- C:/work/bzr-1.13.1/bzrlib/conflicts.py Tue Mar 24 06:50:31 2009 +++ C:/work/bzr-1.13.1mod/bzrlib/conflicts.py Fri May 08 01:04:05 2009 @@ -70,7 +70,7 @@ continue self.outf.write(conflict.path + '\n') else: - self.outf.write(str(conflict) + '\n') + self.outf.write(conflict.path + '\n') class cmd_resolve(commands.Command):