[MERGE][Bug #84043] Commit now invokes an external editor in non-ASCII directories
Alexander Belchenko
bialix at ukr.net
Fri Nov 16 19:33:24 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Watkins пишет:
> This uses the fix John suggested on the bug. It has a test which
> failed previously and now succeeds, but I don't know if it's the
> non-ascii test Alexander was looking for...
see bzrlib.tests.blackbox.test_non_ascii and bzrlib.tests.EncodingAdapter.
bb:resubmit because I really want to see test for invoking external editor
in non-ascii directory (it's the main problem on win32).
It should be in bzrlib.tests.test_msgeditor
=== modified file 'bzrlib/msgeditor.py'
- --- bzrlib/msgeditor.py 2007-10-04 05:35:10 +0000
+++ bzrlib/msgeditor.py 2007-11-16 18:02:37 +0000
@@ -25,6 +25,7 @@
import bzrlib
import bzrlib.config as config
+from bzrlib import osutils
from bzrlib.errors import BzrError, BadCommitMessageEncoding
from bzrlib.trace import warning, mutter
@@ -204,9 +205,9 @@
"""
import tempfile
tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
- - dir=u'.',
^-- I don't think that removing dir parameter is right.
text=True)
- - msgfile = os.fdopen(tmp_fileno, 'w')
mkstemp returns already opened file. why you don't want to use os.fdopen?
+ msgfilename = osutils.basename(msgfilename)
+ msgfile = file(msgfilename, 'w')
try:
if start_message is not None:
msgfile.write("%s\n" % start_message)
=== modified file 'bzrlib/tests/test_msgeditor.py'
- --- bzrlib/tests/test_msgeditor.py 2007-10-04 22:24:29 +0000
+++ bzrlib/tests/test_msgeditor.py 2007-11-16 18:02:03 +0000
@@ -243,6 +243,11 @@
'infotext'])
self.assertFileEqual(expected, msgfilename)
+ def test__create_temp_file_with_commit_template_in_unicode_dir(self):
+ os.mkdir('f\xc5\xb1')
+ os.chdir('f\xc5\xb1')
+ msgeditor._create_temp_file_with_commit_template('infotext')
+
^-- I have suspicious that not all [win32] systems will be able to create such directory.
Why not using \xb5 (mju character)? Or some predefined unicode constants from
EncodingAdapter.py?
def test__create_temp_file_with_empty_commit_template(self):
# empty file
create_file = msgeditor._create_temp_file_with_commit_template
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHPfCEzYr338mxwCURAjX7AJ4wmzlgHQEWMNlLq1PdUyhjwx19EQCgg5aT
Hq987XAtid7Nz/LqEqfU4Xc=
=p2EL
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list