[MERGE][0.16] temp file for commit message in external editor should be opened in text mode (#110901)
Alexander Belchenko
bialix at ukr.net
Tue May 1 10:16:08 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vincent Ladeuil пишет:
>>>>>> "john" == John Arbash Meinel <john at arbash-meinel.com> writes:
>
> john> Alexander Belchenko wrote:
> >> John Arbash Meinel ?8H5B:
> >>>> Please wait before merging.
> >>>> I don't have time to do a full review but there is some cruft in the tests.
> >>>>
> >>>> v-- This is really ugly, and we should find a better way to wrap the lines.
> >>>>
> >>>> + msgfilename, hasinfo = bzrlib.\
> >>>> + msgeditor.\
> >>>> + _create_temp_file_with_commit_template(
> >>>> + 'infotext', '----', 'start message')
> >>
> >> It's for keep lines shorter than 80 chars.
>
> john> I would rather go over 80 characters.
>
> Urgh ;-)
>
> john> PEP8 does say "pragmatism wins".
> john> I would probably do:
> john> from bzrlib.msgeditor import _create_temp_file_with_commit_template
> john> msgfilename, hasinfo = _create_temp_file_with_commit_template(
> john> ....)
> john> That is under 72 characters, since it doesn't wrap in Thunderbird.
>
> Yeah 72 !
>
> What about:
>
> create = bzrlib.msgeditor._create_temp_file_with_commit_template
> msgfilename, hasinfo = create('infotext', '----', 'start message')
Reworked, here is the diff against previous version and new bundle too.
=== modified file 'bzrlib/tests/test_msgeditor.py'
- --- bzrlib/tests/test_msgeditor.py 2007-04-30 19:52:44 +0000
+++ bzrlib/tests/test_msgeditor.py 2007-05-01 09:05:41 +0000
@@ -191,21 +191,22 @@
def test__create_temp_file_with_commit_template(self):
# check that commit template written properly
# and has platform native line-endings (CRLF on win32)
- - msgfilename, hasinfo = bzrlib.\
- - msgeditor.\
- - _create_temp_file_with_commit_template(
- - 'infotext', '----', 'start message')
+ create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
+ msgfilename, hasinfo = create_file('infotext','----','start message')
self.assertNotEqual(None, msgfilename)
self.assertTrue(hasinfo)
- - expected = os.linesep.join(['start message','','',
- - '----','','infotext'])
+ expected = os.linesep.join(['start message',
+ '',
+ '',
+ '----',
+ '',
+ 'infotext'])
self.assertFileEqual(expected, msgfilename)
def test__create_temp_file_with_empty_commit_template(self):
# empty file
- - msgfilename, hasinfo = bzrlib.\
- - msgeditor.\
- - _create_temp_file_with_commit_template('')
+ create_file = bzrlib.msgeditor._create_temp_file_with_commit_template
+ msgfilename, hasinfo = create_file('')
self.assertNotEqual(None, msgfilename)
self.assertFalse(hasinfo)
self.assertFileEqual('', msgfilename)
Because actual fix for the problem already in 0.16rc2, and this bundle only
about proper testing, I'll wait until John do review (if he wants).
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGNwVYzYr338mxwCURAsdaAJsGV9gZunGX8DnLo8PAdyFV7di85gCfWTka
1Wo+VwHOmbSRTjKEOKDDWGY=
=HVC2
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bugfix-110901.v2.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070501/aa3b83fa/attachment-0001.diff
More information about the bazaar
mailing list