def lock_write(self, token=None): if not self._lock_mode: self._lock_mode = 'w' self._lock_count = 1 elif self._lock_mode == 'r': raise errors.ReadOnlyError(self) else: self._lock_count += 1 self.branch.lock_write() return lock.LogicalLockResult(self.unlock)
def lock_read(self): """Lock the repository for read operations. :return: A breezy.lock.LogicalLockResult. """ if not self._lock_mode: self._lock_mode = 'r' self._lock_count = 1 else: self._lock_count += 1 self.branch.lock_read() return lock.LogicalLockResult(self.unlock)
def lock_write(self): """See MutableTree.lock_write().""" self._locks += 1 try: if self._locks == 1: self.branch.lock_write() self._lock_mode = "w" self._populate_from_branch() elif self._lock_mode == "r": raise errors.ReadOnlyError(self) return lock.LogicalLockResult(self.unlock) except BaseException: self._locks -= 1 raise
def lock_read(self): """Lock the memory tree for reading. This triggers population of data from the branch for its revision. """ self._locks += 1 try: if self._locks == 1: self.branch.lock_read() self._lock_mode = "r" self._populate_from_branch() return lock.LogicalLockResult(self.unlock) except BaseException: self._locks -= 1 raise
def lock_write(self): self._calls.append('lw') return lock.LogicalLockResult(self.unlock)
def lock_read(self): self._calls.append('lr') return lock.LogicalLockResult(self.unlock)