/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/lockable_files.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 23:19:12 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20181116231912-e043vpq22bdkxa6q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
        """
151
151
        if self._lock_mode:
152
152
            if (self._lock_mode != 'w'
153
 
                or not self.get_transaction().writeable()):
 
153
                    or not self.get_transaction().writeable()):
154
154
                raise errors.ReadOnlyError(self)
155
155
            self._lock.validate_token(token)
156
156
            self._lock_count += 1
157
157
            return self._token_from_lock
158
158
        else:
159
159
            token_from_lock = self._lock.lock_write(token=token)
160
 
            #traceback.print_stack()
 
160
            # traceback.print_stack()
161
161
            self._lock_mode = 'w'
162
162
            self._lock_count = 1
163
163
            self._set_write_transaction()
171
171
            self._lock_count += 1
172
172
        else:
173
173
            self._lock.lock_read()
174
 
            #traceback.print_stack()
 
174
            # traceback.print_stack()
175
175
            self._lock_mode = 'r'
176
176
            self._lock_count = 1
177
177
            self._set_read_transaction()
193
193
        if self._lock_count > 1:
194
194
            self._lock_count -= 1
195
195
        else:
196
 
            #traceback.print_stack()
 
196
            # traceback.print_stack()
197
197
            self._finish_transaction()
198
198
            try:
199
199
                self._lock.unlock()
256
256
    This is suitable for use only in WorkingTrees (which are at present
257
257
    always local).
258
258
    """
 
259
 
259
260
    def __init__(self, transport, escaped_name, file_modebits, dir_modebits):
260
261
        self._transport = transport
261
262
        self._escaped_name = escaped_name
290
291
        """Create lock mechanism"""
291
292
        # for old-style locks, create the file now
292
293
        self._transport.put_bytes(self._escaped_name, b'',
293
 
                            mode=self._file_modebits)
 
294
                                  mode=self._file_modebits)
294
295
 
295
296
    def validate_token(self, token):
296
297
        if token is not None: