~bzr/ubuntu/maverick/bzr/beta-ppa

« back to all changes in this revision

Viewing changes to debian/patches/06_open_stream_nosuchfile

  • Committer: Max Bowsher
  • Date: 2011-09-16 06:27:01 UTC
  • mfrom: (144.1.21 natty)
  • Revision ID: _@maxb.eu-20110916062701-w5qy68ma51re08sp
Tags: 2.4.1-1~bazaar1~maverick1
MergeĀ 2.4.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Origin: commit, revision id: jelmer@samba.org-20110831101644-wapdg0atc496moap
 
2
Author: Jelmer Vernooij <jelmer@samba.org>
 
3
Last-Update: 2011-08-31
 
4
X-Bzr-Revision-Id: jelmer@samba.org-20110831101644-wapdg0atc496moap
 
5
 
 
6
=== modified file 'bzrlib/tests/test_transport.py'
 
7
--- old/bzrlib/tests/test_transport.py  2011-08-15 14:31:55 +0000
 
8
+++ new/bzrlib/tests/test_transport.py  2011-08-31 10:16:44 +0000
 
9
@@ -760,6 +760,10 @@
 
10
             self.assertEquals(f.read(), 'foo')
 
11
         self.assertEquals(len(calls), 1, calls)
 
12
 
 
13
+    def test_missing_directory(self):
 
14
+        t = self.get_transport('.')
 
15
+        self.assertRaises(errors.NoSuchFile, t.open_write_stream, 'dir/foo')
 
16
+
 
17
 
 
18
 class TestWin32LocalTransport(tests.TestCase):
 
19
 
 
20
 
 
21
=== modified file 'bzrlib/transport/local.py'
 
22
--- old/bzrlib/transport/local.py       2011-08-15 14:31:55 +0000
 
23
+++ new/bzrlib/transport/local.py       2011-08-31 01:35:15 +0000
 
24
@@ -330,7 +330,10 @@
 
25
     def open_write_stream(self, relpath, mode=None):
 
26
         """See Transport.open_write_stream."""
 
27
         abspath = self._abspath(relpath)
 
28
-        handle = osutils.open_file(abspath, 'wb')
 
29
+        try:
 
30
+            handle = osutils.open_file(abspath, 'wb')
 
31
+        except (IOError, OSError),e:
 
32
+            self._translate_error(e, abspath)
 
33
         handle.truncate()
 
34
         if mode is not None:
 
35
             self._check_mode_and_size(abspath, handle.fileno(), mode)
 
36