~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Robert Collins
  • Date: 2010-05-11 08:36:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100511083616-b8fjb19zomwupid0
Make all lock methods return Result objects, rather than lock_read returning self, as per John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1000
1000
    def lock_read(self):
1001
1001
        """Lock the repository for read operations.
1002
1002
 
1003
 
        :return: An object with an unlock method which will release the lock
1004
 
            obtained.
 
1003
        :return: A bzrlib.lock.LogicalLockResult.
1005
1004
        """
1006
1005
        # wrong eventually - want a local lock cache context
1007
1006
        if not self._lock_mode:
1015
1014
                repo.lock_read()
1016
1015
        else:
1017
1016
            self._lock_count += 1
1018
 
        return self
 
1017
        return lock.LogicalLockResult(self.unlock)
1019
1018
 
1020
1019
    def _remote_lock_write(self, token):
1021
1020
        path = self.bzrdir._path_for_remote_call(self._client)
2396
2395
    def lock_read(self):
2397
2396
        """Lock the branch for read operations.
2398
2397
 
2399
 
        :return: An object with an unlock method which will release the lock
2400
 
            obtained.
 
2398
        :return: A bzrlib.lock.LogicalLockResult.
2401
2399
        """
2402
2400
        self.repository.lock_read()
2403
2401
        if not self._lock_mode:
2408
2406
                self._real_branch.lock_read()
2409
2407
        else:
2410
2408
            self._lock_count += 1
2411
 
        return self
 
2409
        return lock.LogicalLockResult(self.unlock)
2412
2410
 
2413
2411
    def _remote_lock_write(self, token):
2414
2412
        if token is None: