~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-08 23:44:40 UTC
  • mfrom: (4731.1.5 debug-flag-relock)
  • Revision ID: pqm@pqm.ubuntu.com-20091008234440-e0thgiawplpcqomd
(andrew) Add -Drelock debug flag that makes noise about wasteful
        unlocking and relocking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
619
619
        return self._custom_format._serializer
620
620
 
621
621
 
622
 
class RemoteRepository(_RpcHelper):
 
622
class RemoteRepository(_RpcHelper, lock._RelockDebugMixin):
623
623
    """Repository accessed over rpc.
624
624
 
625
625
    For the moment most operations are performed using local transport-backed
949
949
    def lock_read(self):
950
950
        # wrong eventually - want a local lock cache context
951
951
        if not self._lock_mode:
 
952
            self._note_lock('r')
952
953
            self._lock_mode = 'r'
953
954
            self._lock_count = 1
954
955
            self._unstacked_provider.enable_cache(cache_misses=True)
974
975
 
975
976
    def lock_write(self, token=None, _skip_rpc=False):
976
977
        if not self._lock_mode:
 
978
            self._note_lock('w')
977
979
            if _skip_rpc:
978
980
                if self._lock_token is not None:
979
981
                    if token != self._lock_token:
2082
2084
        return self._custom_format.supports_set_append_revisions_only()
2083
2085
 
2084
2086
 
2085
 
class RemoteBranch(branch.Branch, _RpcHelper):
 
2087
class RemoteBranch(branch.Branch, _RpcHelper, lock._RelockDebugMixin):
2086
2088
    """Branch stored on a server accessed by HPSS RPC.
2087
2089
 
2088
2090
    At the moment most operations are mapped down to simple file operations.
2319
2321
    def lock_read(self):
2320
2322
        self.repository.lock_read()
2321
2323
        if not self._lock_mode:
 
2324
            self._note_lock('r')
2322
2325
            self._lock_mode = 'r'
2323
2326
            self._lock_count = 1
2324
2327
            if self._real_branch is not None:
2344
2347
 
2345
2348
    def lock_write(self, token=None):
2346
2349
        if not self._lock_mode:
 
2350
            self._note_lock('w')
2347
2351
            # Lock the branch and repo in one remote call.
2348
2352
            remote_tokens = self._remote_lock_write(token)
2349
2353
            self._lock_token, self._repo_lock_token = remote_tokens