~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: INADA Naoki
  • Date: 2011-05-17 00:45:09 UTC
  • mfrom: (5875 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5891.
  • Revision ID: songofacandy@gmail.com-20110517004509-q58negjbdjh7t6u1
mergeĀ fromĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    static_tuple,
33
33
    symbol_versioning,
34
34
    urlutils,
35
 
)
 
35
    versionedfile,
 
36
    vf_repository,
 
37
    )
36
38
from bzrlib.branch import BranchReferenceFormat, BranchWriteLockResult
37
39
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
38
40
from bzrlib.errors import (
43
45
from bzrlib.smart import client, vfs, repository as smart_repo
44
46
from bzrlib.smart.client import _SmartClient
45
47
from bzrlib.revision import NULL_REVISION
46
 
from bzrlib.repository import RepositoryWriteLockResult
 
48
from bzrlib.repository import RepositoryWriteLockResult, _LazyListJoin
47
49
from bzrlib.trace import mutter, note, warning
48
50
 
49
51
 
700
702
        return RemoteBzrDirConfig(self)
701
703
 
702
704
 
703
 
class RemoteRepositoryFormat(_mod_repository.RepositoryFormat):
 
705
class RemoteRepositoryFormat(vf_repository.VersionedFileRepositoryFormat):
704
706
    """Format for repositories accessed over a _SmartClient.
705
707
 
706
708
    Instances of this repository are represented by RemoteRepository
1135
1137
        return RemoteStreamSource(self, to_format)
1136
1138
 
1137
1139
    @needs_read_lock
 
1140
    def get_file_graph(self):
 
1141
        return graph.Graph(self.texts)
 
1142
 
 
1143
    @needs_read_lock
1138
1144
    def has_revision(self, revision_id):
1139
1145
        """True if this repository has a copy of the revision."""
1140
1146
        # Copy of bzrlib.repository.Repository.has_revision
2009
2015
        providers = [self._unstacked_provider]
2010
2016
        if other is not None:
2011
2017
            providers.insert(0, other)
2012
 
        providers.extend(r._make_parents_provider() for r in
2013
 
                         self._fallback_repositories)
2014
 
        return graph.StackedParentsProvider(providers)
 
2018
        return graph.StackedParentsProvider(_LazyListJoin(
 
2019
            providers, self._fallback_repositories))
2015
2020
 
2016
2021
    def _serialise_search_recipe(self, recipe):
2017
2022
        """Serialise a graph search recipe.
2041
2046
            raise errors.UnexpectedSmartServerResponse(response)
2042
2047
 
2043
2048
 
2044
 
class RemoteStreamSink(_mod_repository.StreamSink):
 
2049
class RemoteStreamSink(vf_repository.StreamSink):
2045
2050
 
2046
2051
    def _insert_real(self, stream, src_format, resume_tokens):
2047
2052
        self.target_repo._ensure_real()
2159
2164
                yield substream_kind, substream
2160
2165
 
2161
2166
 
2162
 
class RemoteStreamSource(_mod_repository.StreamSource):
 
2167
class RemoteStreamSource(vf_repository.StreamSource):
2163
2168
    """Stream data from a remote server."""
2164
2169
 
2165
2170
    def get_stream(self, search):
2850
2855
            missing_parent = parent_map[missing_parent]
2851
2856
        raise errors.RevisionNotPresent(missing_parent, self.repository)
2852
2857
 
2853
 
    def _last_revision_info(self):
 
2858
    def _read_last_revision_info(self):
2854
2859
        response = self._call('Branch.last_revision_info', self._remote_path())
2855
2860
        if response[0] != 'ok':
2856
2861
            raise SmartProtocolError('unexpected response code %s' % (response,))