~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Andrew Bennetts
  • Date: 2007-04-11 13:35:32 UTC
  • mto: (2018.5.146 hpss)
  • mto: This revision was merged to the branch mainline in revision 2414.
  • Revision ID: andrew.bennetts@canonical.com-20070411133532-u6x6edf3dmzamnaq
LockDir, Repository and Branch lock token changes from the hpss branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
    def is_locked(self):
232
232
        return self.control_files.is_locked()
233
233
 
234
 
    def lock_write(self):
235
 
        self.control_files.lock_write()
 
234
    def lock_write(self, token=None):
 
235
        """Lock this repository for writing.
 
236
        
 
237
        :param token: if this is already locked, then lock_write will fail
 
238
            unless the token matches the existing lock.
 
239
        :returns: a token if this instance supports tokens, otherwise None.
 
240
        :raises TokenLockingNotSupported: when a token is given but this
 
241
            instance doesn't support using token locks.
 
242
        :raises MismatchedToken: if the specified token doesn't match the token
 
243
            of the existing lock.
 
244
 
 
245
        XXX: this docstring is duplicated in many places, e.g. lockable_files.py
 
246
        """
 
247
        return self.control_files.lock_write(token=token)
236
248
 
237
249
    def lock_read(self):
238
250
        self.control_files.lock_read()
240
252
    def get_physical_lock_status(self):
241
253
        return self.control_files.get_physical_lock_status()
242
254
 
 
255
    def leave_lock_in_place(self):
 
256
        """Tell this repository not to release the physical lock when this
 
257
        object is unlocked.
 
258
        
 
259
        If lock_write doesn't return a token, then this method is not supported.
 
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
        If lock_write doesn't return a token, then this method is not supported.
 
268
        """
 
269
        self.control_files.dont_leave_in_place()
 
270
 
243
271
    @needs_read_lock
244
272
    def gather_stats(self, revid=None, committers=None):
245
273
        """Gather statistics from a revision id.