/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 bzrlib/repository.py

Add Repository.{dont_,}leave_lock_in_place.

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
    def is_locked(self):
234
234
        return self.control_files.is_locked()
235
235
 
236
 
    def lock_write(self):
237
 
        self.control_files.lock_write()
 
236
    def lock_write(self, token=None):
 
237
        """Lock this repository for writing.
 
238
        
 
239
        :param token: if this is already locked, then lock_write will fail
 
240
            unless the token matches the existing lock.
 
241
        :returns: a token if this instance supports tokens, otherwise None.
 
242
        :raises TokenLockingNotSupported: when a token is given but this
 
243
            instance doesn't support using token locks.
 
244
        :raises MismatchedToken: if the specified token doesn't match the token
 
245
            of the existing lock.
 
246
 
 
247
        XXX: this docstring is duplicated in many places, e.g. lockable_files.py
 
248
        """
 
249
        return self.control_files.lock_write(token=token)
238
250
 
239
251
    def lock_read(self):
240
252
        self.control_files.lock_read()
242
254
    def get_physical_lock_status(self):
243
255
        return self.control_files.get_physical_lock_status()
244
256
 
 
257
    def leave_lock_in_place(self):
 
258
        """Tell this repository not to release the physical lock when this
 
259
        object is unlocked.
 
260
        """
 
261
        self.control_files.leave_in_place()
 
262
 
 
263
    def dont_leave_lock_in_place(self):
 
264
        """Tell this repository to release the physical lock when this
 
265
        object is unlocked, even if it didn't originally acquire it.
 
266
        """
 
267
        self.control_files.dont_leave_in_place()
 
268
 
245
269
    @needs_read_lock
246
270
    def gather_stats(self, revid=None, committers=None):
247
271
        """Gather statistics from a revision id.