/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Implement RemoteRepository.get_revision_graph (Wouter van Heyst, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib import branch, errors, repository
24
24
from bzrlib.branch import BranchReferenceFormat
25
25
from bzrlib.bzrdir import BzrDir, BzrDirFormat, RemoteBzrDirFormat
 
26
from bzrlib.errors import NoSuchRevision
26
27
from bzrlib.revision import NULL_REVISION
27
28
from bzrlib.smart import client, vfs
28
29
from bzrlib.urlutils import unescape
196
197
            self._client = _client
197
198
        self._format = RemoteRepositoryFormat()
198
199
 
 
200
    def get_revision_graph(self, revision_id=None):
 
201
        """See Repository.get_revision_graph()."""
 
202
        if revision_id is None:
 
203
            revision_id = ''
 
204
        elif revision_id == NULL_REVISION:
 
205
            return {}
 
206
 
 
207
        path = self.bzrdir._path_for_remote_call(self._client)
 
208
        response = self._client.call2('Repository.get_revision_graph', path, revision_id.encode('utf8'))
 
209
        assert response[0][0] in ('ok', 'nosuchrevision'), 'unexpected response code %s' % (response[0],)
 
210
        if response[0][0] == 'ok':
 
211
            coded = response[1].read_body_bytes()
 
212
            lines = coded.decode('utf8').split('\n')
 
213
            revision_graph = {}
 
214
            # FIXME
 
215
            for line in lines:
 
216
                d = list(line.split())
 
217
                revision_graph[d[0]] = d[1:]
 
218
                
 
219
            return revision_graph
 
220
        else:
 
221
            assert response[1] != ''
 
222
            raise NoSuchRevision(self, revision_id)
 
223
 
199
224
    def has_revision(self, revision_id):
200
225
        """See Repository.has_revision()."""
201
226
        path = self.bzrdir._path_for_remote_call(self._client)