~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Alexander Belchenko
  • Date: 2009-05-28 18:03:38 UTC
  • mto: This revision was merged to the branch mainline in revision 4395.
  • Revision ID: bialix@ukr.net-20090528180338-olw1ccqk28afjhiz
Workaround for running `make exe` second time: remove all compiled extensions because they will be recompiled anyway.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import bz2
21
21
 
22
22
from bzrlib import (
23
 
    bencode,
24
23
    branch,
25
24
    bzrdir,
26
25
    config,
46
45
from bzrlib.smart import client, vfs, repository as smart_repo
47
46
from bzrlib.revision import ensure_null, NULL_REVISION
48
47
from bzrlib.trace import mutter, note, warning
 
48
from bzrlib.util import bencode
49
49
 
50
50
 
51
51
class _RpcHelper(object):
670
670
        self._ensure_real()
671
671
        return self._real_repository.suspend_write_group()
672
672
 
673
 
    def get_missing_parent_inventories(self, check_for_missing_texts=True):
 
673
    def get_missing_parent_inventories(self):
674
674
        self._ensure_real()
675
 
        return self._real_repository.get_missing_parent_inventories(
676
 
            check_for_missing_texts=check_for_missing_texts)
 
675
        return self._real_repository.get_missing_parent_inventories()
677
676
 
678
677
    def _ensure_real(self):
679
678
        """Ensure that there is a _real_repository set.
861
860
            self._unstacked_provider.enable_cache(cache_misses=True)
862
861
            if self._real_repository is not None:
863
862
                self._real_repository.lock_read()
864
 
            for repo in self._fallback_repositories:
865
 
                repo.lock_read()
866
863
        else:
867
864
            self._lock_count += 1
 
865
        for repo in self._fallback_repositories:
 
866
            repo.lock_read()
868
867
 
869
868
    def _remote_lock_write(self, token):
870
869
        path = self.bzrdir._path_for_remote_call(self._client)
902
901
            self._lock_count = 1
903
902
            cache_misses = self._real_repository is None
904
903
            self._unstacked_provider.enable_cache(cache_misses=cache_misses)
905
 
            for repo in self._fallback_repositories:
906
 
                # Writes don't affect fallback repos
907
 
                repo.lock_read()
908
904
        elif self._lock_mode == 'r':
909
905
            raise errors.ReadOnlyError(self)
910
906
        else:
911
907
            self._lock_count += 1
 
908
        for repo in self._fallback_repositories:
 
909
            # Writes don't affect fallback repos
 
910
            repo.lock_read()
912
911
        return self._lock_token or None
913
912
 
914
913
    def leave_lock_in_place(self):
1016
1015
                self._lock_token = None
1017
1016
                if not self._leave_lock:
1018
1017
                    self._unlock(old_token)
1019
 
        # Fallbacks are always 'lock_read()' so we don't pay attention to
1020
 
        # self._leave_lock
1021
 
        for repo in self._fallback_repositories:
1022
 
            repo.unlock()
1023
1018
 
1024
1019
    def break_lock(self):
1025
1020
        # should hand off to the network
1089
1084
        # We need to accumulate additional repositories here, to pass them in
1090
1085
        # on various RPC's.
1091
1086
        #
1092
 
        if self.is_locked():
1093
 
            # We will call fallback.unlock() when we transition to the unlocked
1094
 
            # state, so always add a lock here. If a caller passes us a locked
1095
 
            # repository, they are responsible for unlocking it later.
1096
 
            repository.lock_read()
1097
1087
        self._fallback_repositories.append(repository)
1098
1088
        # If self._real_repository was parameterised already (e.g. because a
1099
1089
        # _real_branch had its get_stacked_on_url method called), then the
1981
1971
        except (errors.NotStacked, errors.UnstackableBranchFormat,
1982
1972
            errors.UnstackableRepositoryFormat), e:
1983
1973
            return
1984
 
        self._activate_fallback_location(fallback_url)
 
1974
        self._activate_fallback_location(fallback_url, None)
1985
1975
 
1986
1976
    def _get_config(self):
1987
1977
        return RemoteBranchConfig(self)