~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Robert Collins
  • Date: 2009-02-20 05:05:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4024.
  • Revision ID: robertc@robertcollins.net-20090220050525-o3i6wve7yigkx6i9
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# across to run on the server.
19
19
 
20
20
import bz2
 
21
import struct
21
22
 
22
23
from bzrlib import (
23
24
    branch,
325
326
        self._creating_repo._ensure_real()
326
327
        return self._creating_repo._real_repository._format.network_name()
327
328
 
 
329
    @property
 
330
    def _serializer(self):
 
331
        # We should only be getting asked for the serializer for
 
332
        # RemoteRepositoryFormat objects except when the RemoteRepositoryFormat
 
333
        # object is a concrete instance for a RemoteRepository. In this case
 
334
        # we know the creating_repo and can use it to supply the serializer.
 
335
        self._creating_repo._ensure_real()
 
336
        return self._creating_repo._real_repository._format._serializer
 
337
 
328
338
 
329
339
class RemoteRepository(_RpcHelper):
330
340
    """Repository accessed over rpc.
471
481
            
472
482
        return revision_graph
473
483
 
 
484
    def _get_sink(self):
 
485
        """See Repository._get_sink()."""
 
486
        self._ensure_real()
 
487
        return self._real_repository._get_sink()
 
488
 
474
489
    def has_revision(self, revision_id):
475
490
        """See Repository.has_revision()."""
476
491
        if revision_id == NULL_REVISION:
1256
1271
            raise errors.UnexpectedSmartServerResponse(response)
1257
1272
 
1258
1273
 
 
1274
def _length_prefix(bytes):
 
1275
    return struct.pack('!L', len(bytes))
 
1276
 
 
1277
 
1259
1278
class RemoteBranchLockableFiles(LockableFiles):
1260
1279
    """A 'LockableFiles' implementation that talks to a smart server.
1261
1280