~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

mergeĀ fromĀ dirstate

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
 
97
97
        def __init__(self, filename):
98
98
            # standard IO errors get exposed directly.
99
 
            self._open(filename, 'wb')
 
99
            self._open(filename, 'rb+')
100
100
            try:
101
101
                self.filename = realpath(filename)
102
102
                if self.filename in self.open_locks:
176
176
 
177
177
        class _w32c_WriteLock(_w32c_FileLock):
178
178
            def __init__(self, filename):
179
 
                _w32c_FileLock._lock(self, filename, 'wb',
 
179
                _w32c_FileLock._lock(self, filename, 'rb+',
180
180
                                     LOCK_EX + LOCK_NB)
181
181
 
182
182
 
211
211
 
212
212
            class _msvc_WriteLock(_msvc_FileLock):
213
213
                def __init__(self, filename):
214
 
                    _msvc_lock(self._open(filename, 'wb'), self.LOCK_EX)
 
214
                    _msvc_lock(self._open(filename, 'rb+'), self.LOCK_EX)
215
215
 
216
216
 
217
217
            def _msvc_lock(f, flags):