Rev 3013: commit now can invoke an external editor in a non-ascii directory. (Watkins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Nov 22 20:17:25 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3013
revision-id: pqm at pqm.ubuntu.com-20071122201722-4l5bgljqn7qdux7f
parent: pqm at pqm.ubuntu.com-20071122050938-la5hkrql1mag6u7p
parent: d.m.watkins at warwick.ac.uk-20071122143449-ktm5dvx570zxeapg
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-11-22 20:17:22 +0000
message:
  commit now can invoke an external editor in a non-ascii directory.  (Watkins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
    ------------------------------------------------------------
    revno: 3004.1.10
    merged: d.m.watkins at warwick.ac.uk-20071122143449-ktm5dvx570zxeapg
    parent: d.m.watkins at warwick.ac.uk-20071120141539-g2xhdqou1dcewmqz
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Thu 2007-11-22 14:34:49 +0000
    message:
      Modified NEWS as suggested by Alexander.
    ------------------------------------------------------------
    revno: 3004.1.9
    merged: d.m.watkins at warwick.ac.uk-20071120141539-g2xhdqou1dcewmqz
    parent: d.m.watkins at warwick.ac.uk-20071120141514-x6hs0nrze1tjkepz
    parent: pqm at pqm.ubuntu.com-20071119235416-b8dvkk17vngbf99s
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Tue 2007-11-20 14:15:39 +0000
    message:
      Merged bzr.dev r3007.
    ------------------------------------------------------------
    revno: 3004.1.8
    merged: d.m.watkins at warwick.ac.uk-20071120141514-x6hs0nrze1tjkepz
    parent: d.m.watkins at warwick.ac.uk-20071117180403-1mbbqxztty9o48tu
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Tue 2007-11-20 14:15:14 +0000
    message:
      Changed TestSkipped to TestNotApplicable as suggested by Aaron.
    ------------------------------------------------------------
    revno: 3004.1.7
    merged: d.m.watkins at warwick.ac.uk-20071117180403-1mbbqxztty9o48tu
    parent: d.m.watkins at warwick.ac.uk-20071117175743-xqlnfg5exidzua80
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Sat 2007-11-17 18:04:03 +0000
    message:
      test__create_temp_file_with_commit_template_in_unicode_dir now uses EncodingTestAdapter info.
    ------------------------------------------------------------
    revno: 3004.1.6
    merged: d.m.watkins at warwick.ac.uk-20071117175743-xqlnfg5exidzua80
    parent: d.m.watkins at warwick.ac.uk-20071117175450-ev2emfm5rkr4pb80
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Sat 2007-11-17 17:57:43 +0000
    message:
      test__create_temp_file_with_commit_template_in_unicode_dir is now run with the various permutations of EncodingTestAdapter.
    ------------------------------------------------------------
    revno: 3004.1.5
    merged: d.m.watkins at warwick.ac.uk-20071117175450-ev2emfm5rkr4pb80
    parent: d.m.watkins at warwick.ac.uk-20071117172208-m47tdnnatvm2ir2u
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Sat 2007-11-17 17:54:50 +0000
    message:
      Added adapt_tests which will adapt tests at a finer-than-module level.
    ------------------------------------------------------------
    revno: 3004.1.4
    merged: d.m.watkins at warwick.ac.uk-20071117172208-m47tdnnatvm2ir2u
    parent: d.m.watkins at warwick.ac.uk-20071116180416-9r6ael14u87d0ds9
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Sat 2007-11-17 17:22:08 +0000
    message:
      Modified fix as suggested by John on-list.
    ------------------------------------------------------------
    revno: 3004.1.3
    merged: d.m.watkins at warwick.ac.uk-20071116180416-9r6ael14u87d0ds9
    parent: d.m.watkins at warwick.ac.uk-20071116180237-pimvihk44zkg7gv7
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Fri 2007-11-16 18:04:16 +0000
    message:
      Added NEWS item.
    ------------------------------------------------------------
    revno: 3004.1.2
    merged: d.m.watkins at warwick.ac.uk-20071116180237-pimvihk44zkg7gv7
    parent: d.m.watkins at warwick.ac.uk-20071116180203-3j6ley1qygkatoyr
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Fri 2007-11-16 18:02:37 +0000
    message:
      Temp files containing a commit message can now be created in a folder with a Unicode name.
    ------------------------------------------------------------
    revno: 3004.1.1
    merged: d.m.watkins at warwick.ac.uk-20071116180203-3j6ley1qygkatoyr
    parent: pqm at pqm.ubuntu.com-20071116062543-dl3xkea5ri27qwnz
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 84043
    timestamp: Fri 2007-11-16 18:02:03 +0000
    message:
      Added (failing) test to check if a temp file containing a commit message can be created in a folder with a Unicode name.
=== modified file 'NEWS'
--- a/NEWS	2007-11-22 03:29:11 +0000
+++ b/NEWS	2007-11-22 20:17:22 +0000
@@ -52,6 +52,9 @@
    * A progress bar has been added for knitpack -> knitpack fetching.
      (Robert Collins, #157789)
 
+   * ``commit`` is now able to invoke an external editor in a non-ascii
+     directory. (Daniel Watkins, #84043)
+
    * Detect invalid transport reuse attempts by catching invalid URLs.
      (Vincent Ladeuil, #161819)
 

=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py	2007-10-04 05:35:10 +0000
+++ b/bzrlib/msgeditor.py	2007-11-17 17:22:08 +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,8 +205,9 @@
     """
     import tempfile
     tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
-                                               dir=u'.',
+                                               dir='.',
                                                text=True)
+    msgfilename = osutils.basename(msgfilename)
     msgfile = os.fdopen(tmp_fileno, 'w')
     try:
         if start_message is not None:

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-11-14 21:07:54 +0000
+++ b/bzrlib/tests/__init__.py	2007-11-17 17:57:43 +0000
@@ -94,6 +94,7 @@
                           TestSuite,
                           TestLoader,
                           )
+from bzrlib.tests.EncodingAdapter import EncodingTestAdapter
 from bzrlib.tests.treeshape import build_tree_contents
 from bzrlib.workingtree import WorkingTree, WorkingTreeFormat2
 
@@ -2511,6 +2512,10 @@
     from bzrlib.tests.test_transport_implementations import TransportTestProviderAdapter
     adapter = TransportTestProviderAdapter()
     adapt_modules(test_transport_implementations, adapter, loader, suite)
+    adapt_tests(
+        ["bzrlib.tests.test_msgeditor.MsgEditorTest."
+         "test__create_temp_file_with_commit_template_in_unicode_dir"],
+        EncodingTestAdapter(), loader, suite)
     for package in packages_to_test():
         suite.addTest(package.test_suite())
     for m in MODULES_TO_TEST:
@@ -2602,6 +2607,12 @@
         suite.addTests(adapter.adapt(test))
 
 
+def adapt_tests(tests_list, adapter, loader, suite):
+    """Adapt the tests in tests_list using adapter and add to suite."""
+    for test in tests_list:
+        suite.addTests(adapter.adapt(loader.loadTestsFromName(test)))
+
+
 def _rmtree_temp_dir(dirname):
     # If LANG=C we probably have created some bogus paths
     # which rmtree(unicode) will fail to delete

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py	2007-10-04 22:24:29 +0000
+++ b/bzrlib/tests/test_msgeditor.py	2007-11-20 14:15:14 +0000
@@ -35,6 +35,7 @@
 from bzrlib.tests import (
     probe_bad_non_ascii,
     TestCaseWithTransport,
+    TestNotApplicable,
     TestSkipped,
     )
 from bzrlib.trace import mutter
@@ -243,6 +244,14 @@
                                     'infotext'])
         self.assertFileEqual(expected, msgfilename)
 
+    def test__create_temp_file_with_commit_template_in_unicode_dir(self):
+        if hasattr(self, 'info'):
+            os.mkdir(self.info['directory'])
+            os.chdir(self.info['directory'])
+            msgeditor._create_temp_file_with_commit_template('infotext')
+        else:
+            raise TestNotApplicable('Test run elsewhere with non-ascii data.')
+
     def test__create_temp_file_with_empty_commit_template(self):
         # empty file
         create_file = msgeditor._create_temp_file_with_commit_template




More information about the bazaar-commits mailing list