Rev 5541: (vila) Create commit message files in TMPDIR instead of the current dir in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Nov 18 16:22:49 GMT 2010


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

------------------------------------------------------------
revno: 5541 [merge]
revision-id: pqm at pqm.ubuntu.com-20101118162246-1bpgdeitiy7hcr8i
parent: pqm at pqm.ubuntu.com-20101116071647-ibe1m73iokndpuyf
parent: v.ladeuil+lp at free.fr-20101111134502-1va4yqkxptwnfhut
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-11-18 16:22:46 +0000
message:
  (vila) Create commit message files in TMPDIR instead of the current dir
   (Vincent Ladeuil)
modified:
  bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
  bzrlib/tests/test_msgeditor.py test_msgeditor.py-20051202041359-920315ec6011ee51
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py	2010-09-13 10:04:19 +0000
+++ b/bzrlib/msgeditor.py	2010-11-11 13:45:02 +0000
@@ -208,28 +208,25 @@
 
 def _create_temp_file_with_commit_template(infotext,
                                            ignoreline=DEFAULT_IGNORE_LINE,
-                                           start_message=None):
+                                           start_message=None,
+                                           tmpdir=None):
     """Create temp file and write commit template in it.
 
-    :param infotext:    Text to be displayed at bottom of message
-                        for the user's reference;
-                        currently similar to 'bzr status'.
-                        The text is already encoded.
+    :param infotext: Text to be displayed at bottom of message for the
+        user's reference; currently similar to 'bzr status'.  The text is
+        already encoded.
 
     :param ignoreline:  The separator to use above the infotext.
 
-    :param start_message:   The text to place above the separator, if any.
-                            This will not be removed from the message
-                            after the user has edited it.
-                            The string is already encoded
+    :param start_message: The text to place above the separator, if any.
+        This will not be removed from the message after the user has edited
+        it.  The string is already encoded
 
     :return:    2-tuple (temp file name, hasinfo)
     """
     import tempfile
     tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
-                                               dir='.',
-                                               text=True)
-    msgfilename = osutils.basename(msgfilename)
+                                               dir=tmpdir, text=True)
     msgfile = os.fdopen(tmp_fileno, 'w')
     try:
         if start_message is not None:

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py	2010-08-29 14:32:45 +0000
+++ b/bzrlib/tests/test_msgeditor.py	2010-11-11 13:45:02 +0000
@@ -301,9 +301,12 @@
     def test__create_temp_file_with_commit_template_in_unicode_dir(self):
         self.requireFeature(tests.UnicodeFilenameFeature)
         if hasattr(self, 'info'):
-            os.mkdir(self.info['directory'])
-            os.chdir(self.info['directory'])
-            msgeditor._create_temp_file_with_commit_template('infotext')
+            tmpdir = self.info['directory']
+            os.mkdir(tmpdir)
+            # Force the creation of temp file in a directory whose name
+            # requires some encoding support
+            msgeditor._create_temp_file_with_commit_template('infotext',
+                                                             tmpdir=tmpdir)
         else:
             raise TestNotApplicable('Test run elsewhere with non-ascii data.')
 

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2010-11-11 23:48:07 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2010-11-18 16:22:46 +0000
@@ -48,6 +48,10 @@
 * Better message if there is an error while setting ownership of
   ``.bazaar`` directory. (Parth Malwankar, #657553)
 
+* Don't create commit message files in the current directory to avoid nasty
+  interactions with emacs (which tries to establish the status of the file
+  during the commit which breaks on windows). (Vincent Ladeuil, #673637)
+
 * ``bzr resolve --take-other <file>`` will not crash anymore if ``<file>``
   is involved in a text conflict (but the conflict is still not
   resolved). (Vincent Ladeuil, #646961)




More information about the bazaar-commits mailing list