Rev 4808: 2.1.0b4-win32-msgeditor was accepted, including some of Martin <gz>'s changes. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

John Arbash Meinel john at arbash-meinel.com
Tue Nov 17 23:01:53 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted

------------------------------------------------------------
revno: 4808 [merge]
revision-id: john at arbash-meinel.com-20091117230148-rrc2la94nta5tpl8
parent: john at arbash-meinel.com-20091117222437-b3ljdokx17dql57q
parent: gzlist at googlemail.com-20091117210253-p7gf4jf1wy0wr7bx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-accepted
timestamp: Tue 2009-11-17 17:01:48 -0600
message:
  2.1.0b4-win32-msgeditor was accepted, including some of Martin <gz>'s changes.
modified:
  bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
  bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
-------------- next part --------------
=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/msgeditor.py	2009-11-17 21:02:01 +0000
@@ -64,7 +64,7 @@
             x = call(edargs + [filename])
         except OSError, e:
             # We're searching for an editor, so catch safe errors and continue
-            if e.errno in (errno.ENOENT, errno.EACCES):
+            if e.errno in (errno.ENOENT, errno.EACCES, errno.ENOEXEC, 193):
                 if candidate_source is not None:
                     # We tried this editor because some user configuration (an
                     # environment variable or config file) said to try it.  Let

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py	2009-10-06 14:40:37 +0000
+++ b/bzrlib/tests/test_msgeditor.py	2009-11-17 21:02:53 +0000
@@ -35,6 +35,7 @@
     edit_commit_message_encoded
 )
 from bzrlib.tests import (
+    TestCaseInTempDir,
     TestCaseWithTransport,
     TestNotApplicable,
     TestSkipped,
@@ -290,7 +291,10 @@
         # Call _run_editor, capturing mutter.warning calls.
         warnings = []
         def warning(*args):
-            warnings.append(args[0] % args[1:])
+            if len(args) > 1:
+                warnings.append(args[0] % args[1:])
+            else:
+                warnings.append(args[0])
         _warning = trace.warning
         trace.warning = warning
         try:
@@ -364,3 +368,20 @@
         commit_obj = commit.Commit()
         self.assertEquals("save me some typing\n",
             msgeditor.generate_commit_message_template(commit_obj))
+
+
+# GZ 2009-11-17: This wants moving to osutils when the errno checking code is
+class TestPlatformErrnoWorkarounds(TestCaseInTempDir):
+    """Ensuring workarounds enshrined in code actually serve a purpose"""
+    def test_windows(self):
+        if sys.platform != "win32":
+            raise TestSkipped("Workarounds for windows only")
+        import subprocess, errno
+        ERROR_BAD_EXE_FORMAT = 193
+        file("textfile.txt", "w").close()
+        e = self.assertRaises(WindowsError, subprocess.call, "textfile.txt")
+        if sys.version_info > (2, 5):
+            self.assertEqual(e.errno, errno.ENOEXEC)
+            self.assertEqual(e.winerror, ERROR_BAD_EXE_FORMAT)
+        else:
+            self.assertEqual(e.errno, ERROR_BAD_EXE_FORMAT)



More information about the bazaar-commits mailing list