Merge lp:~bialix/bzr/lock-unicode-win32 into lp:~bzr/bzr/trunk-old

Proposed by Alexander Belchenko
Status: Superseded
Proposed branch: lp:~bialix/bzr/lock-unicode-win32
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 136 lines
To merge this branch: bzr merge lp:~bialix/bzr/lock-unicode-win32
Reviewer Review Type Date Requested Status
John A Meinel Pending
bzr-core Pending
Review via email: mp+8297@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexander Belchenko (bialix) wrote :

This is mandatory for 1.17 to avoid regressions re OS locks on unicode paths on Windows. Previously there is landed patch from Martin <gzlist> to use CreateFile API for locking. But that patch does not use unicode API on Windows NT based systems.

Please, merge.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/help_topics/en/debug-flags.txt'
2--- bzrlib/help_topics/en/debug-flags.txt 2009-03-18 23:43:51 +0000
3+++ bzrlib/help_topics/en/debug-flags.txt 2009-07-07 09:35:11 +0000
4@@ -15,6 +15,8 @@
5 -Dhashcache Log every time a working file is read to determine its hash.
6 -Dhooks Trace hook execution.
7 -Dhpss Trace smart protocol requests and responses.
8+-Dhpssdetail More hpss details.
9+-Dhpssvfs Traceback on vfs access to Remote objects.
10 -Dhttp Trace http connections, requests and responses
11 -Dindex Trace major index operations.
12 -Dknit Trace knit operations.
13
14=== modified file 'bzrlib/lock.py'
15--- bzrlib/lock.py 2009-06-19 10:04:02 +0000
16+++ bzrlib/lock.py 2009-07-07 09:35:10 +0000
17@@ -301,13 +301,19 @@
18
19
20 if have_pywin32 and sys.platform == 'win32':
21+ if os.path.supports_unicode_filenames:
22+ # for Windows NT/2K/XP/etc
23+ win32file_CreateFile = win32file.CreateFileW
24+ else:
25+ # for Windows 98
26+ win32file_CreateFile = win32file.CreateFile
27
28 class _w32c_FileLock(_OSLock):
29
30 def _open(self, filename, access, share, cflags, pymode):
31 self.filename = osutils.realpath(filename)
32 try:
33- self._handle = win32file.CreateFile(filename, access, share,
34+ self._handle = win32file_CreateFile(filename, access, share,
35 None, win32file.OPEN_ALWAYS,
36 win32file.FILE_ATTRIBUTE_NORMAL, None)
37 except pywintypes.error, e:
38
39=== modified file 'bzrlib/remote.py'
40--- bzrlib/remote.py 2009-06-26 09:24:34 +0000
41+++ bzrlib/remote.py 2009-07-07 09:35:11 +0000
42@@ -723,7 +723,7 @@
43 invocation. If in doubt chat to the bzr network team.
44 """
45 if self._real_repository is None:
46- if 'hpss' in debug.debug_flags:
47+ if 'hpssvfs' in debug.debug_flags:
48 import traceback
49 warning('VFS Repository access triggered\n%s',
50 ''.join(traceback.format_stack()))
51
52=== modified file 'bzrlib/smart/medium.py'
53--- bzrlib/smart/medium.py 2009-06-10 03:56:49 +0000
54+++ bzrlib/smart/medium.py 2009-07-07 09:35:11 +0000
55@@ -472,7 +472,8 @@
56 if not line.endswith('\n'):
57 # end of file encountered reading from server
58 raise errors.ConnectionReset(
59- "please check connectivity and permissions")
60+ "Unexpected end of message. Please check connectivity "
61+ "and permissions, and report a bug if problems persist.")
62 return line
63
64 def _read_line(self):
65
66=== modified file 'bzrlib/smart/message.py'
67--- bzrlib/smart/message.py 2009-04-24 00:45:11 +0000
68+++ bzrlib/smart/message.py 2009-07-07 09:35:11 +0000
69@@ -283,7 +283,9 @@
70 self._protocol_decoder._get_in_buffer()[:10],
71 self._protocol_decoder.state_accept.__name__)
72 raise errors.ConnectionReset(
73- "please check connectivity and permissions")
74+ "Unexpected end of message. "
75+ "Please check connectivity and permissions, and report a bug "
76+ "if problems persist.")
77 self._protocol_decoder.accept_bytes(bytes)
78
79 def protocol_error(self, exception):
80
81=== modified file 'bzrlib/tests/per_lock/__init__.py'
82--- bzrlib/tests/per_lock/__init__.py 2009-03-23 14:59:43 +0000
83+++ bzrlib/tests/per_lock/__init__.py 2009-07-07 09:35:11 +0000
84@@ -39,7 +39,6 @@
85 return result
86
87
88-
89 def load_tests(standard_tests, module, loader):
90 submod_tests = loader.loadTestsFromModuleNames([
91 'bzrlib.tests.per_lock.test_lock',
92
93=== modified file 'bzrlib/tests/per_lock/test_lock.py'
94--- bzrlib/tests/per_lock/test_lock.py 2009-03-23 14:59:43 +0000
95+++ bzrlib/tests/per_lock/test_lock.py 2009-07-07 09:35:11 +0000
96@@ -21,6 +21,7 @@
97 osutils,
98 )
99
100+from bzrlib.tests import UnicodeFilenameFeature
101 from bzrlib.tests.per_lock import TestCaseWithLock
102
103
104@@ -160,3 +161,18 @@
105 b_lock.unlock()
106 if c_lock is not None:
107 c_lock.unlock()
108+
109+
110+class TestLockUnicodePath(TestCaseWithLock):
111+
112+ _test_needs_features = [UnicodeFilenameFeature]
113+
114+ def test_read_lock(self):
115+ self.build_tree([u'\u1234'])
116+ u_lock = self.read_lock(u'\u1234')
117+ self.addCleanup(u_lock.unlock)
118+
119+ def test_write_lock(self):
120+ self.build_tree([u'\u1234'])
121+ u_lock = self.write_lock(u'\u1234')
122+ self.addCleanup(u_lock.unlock)
123
124=== modified file 'bzrlib/tests/test_smart_transport.py'
125--- bzrlib/tests/test_smart_transport.py 2009-07-04 08:37:34 +0000
126+++ bzrlib/tests/test_smart_transport.py 2009-07-07 09:35:11 +0000
127@@ -1507,7 +1507,8 @@
128 ex = self.assertRaises(errors.ConnectionReset,
129 response_handler.read_response_tuple)
130 self.assertEqual("Connection closed: "
131- "please check connectivity and permissions ",
132+ "Unexpected end of message. Please check connectivity "
133+ "and permissions, and report a bug if problems persist. ",
134 str(ex))
135
136 def test_server_offset_serialisation(self):