/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

  • Committer: Robert Collins
  • Date: 2007-08-22 00:00:26 UTC
  • mfrom: (2739 +trunk)
  • mto: (2592.3.96 repository)
  • mto: This revision was merged to the branch mainline in revision 2742.
  • Revision ID: robertc@robertcollins.net-20070822000026-kvufiqhlreokb1en
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from bzrlib.lockable_files import LockableFiles
34
34
from bzrlib.revision import NULL_REVISION
35
35
from bzrlib.smart import client, vfs
 
36
from bzrlib.symbol_versioning import (
 
37
    deprecated_method,
 
38
    zero_ninetyone,
 
39
    )
36
40
from bzrlib.trace import note
37
41
 
38
42
# Note: RemoteBzrDirFormat is in bzrdir.py
249
253
        self._lock_count = 0
250
254
        self._leave_lock = False
251
255
 
 
256
    def abort_write_group(self):
 
257
        """Complete a write group on the decorated repository.
 
258
        
 
259
        Smart methods peform operations in a single step so this api
 
260
        is not really applicable except as a compatibility thunk
 
261
        for older plugins that don't use e.g. the CommitBuilder
 
262
        facility.
 
263
        """
 
264
        self._ensure_real()
 
265
        return self._real_repository.abort_write_group()
 
266
 
 
267
    def commit_write_group(self):
 
268
        """Complete a write group on the decorated repository.
 
269
        
 
270
        Smart methods peform operations in a single step so this api
 
271
        is not really applicable except as a compatibility thunk
 
272
        for older plugins that don't use e.g. the CommitBuilder
 
273
        facility.
 
274
        """
 
275
        self._ensure_real()
 
276
        return self._real_repository.commit_write_group()
 
277
 
252
278
    def _ensure_real(self):
253
279
        """Ensure that there is a _real_repository set.
254
280
 
299
325
        assert response[0] in ('yes', 'no'), 'unexpected response code %s' % (response,)
300
326
        return response[0] == 'yes'
301
327
 
 
328
    def has_same_location(self, other):
 
329
        return (self.__class__ == other.__class__ and
 
330
                self.bzrdir.transport.base == other.bzrdir.transport.base)
 
331
        
302
332
    def get_graph(self, other_repository=None):
303
333
        """Return the graph for this repository format"""
304
334
        return self._real_repository.get_graph(other_repository)
337
367
        """See Repository.get_physical_lock_status()."""
338
368
        return False
339
369
 
 
370
    def is_in_write_group(self):
 
371
        """Return True if there is an open write group.
 
372
 
 
373
        write groups are only applicable locally for the smart server..
 
374
        """
 
375
        if self._real_repository:
 
376
            return self._real_repository.is_in_write_group()
 
377
 
 
378
    def is_locked(self):
 
379
        return self._lock_count >= 1
 
380
 
340
381
    def is_shared(self):
341
382
        """See Repository.is_shared()."""
342
383
        path = self.bzrdir._path_for_remote_call(self._client)
408
449
        elif self._lock_mode == 'r':
409
450
            self._real_repository.lock_read()
410
451
 
 
452
    def start_write_group(self):
 
453
        """Start a write group on the decorated repository.
 
454
        
 
455
        Smart methods peform operations in a single step so this api
 
456
        is not really applicable except as a compatibility thunk
 
457
        for older plugins that don't use e.g. the CommitBuilder
 
458
        facility.
 
459
        """
 
460
        self._ensure_real()
 
461
        return self._real_repository.start_write_group()
 
462
 
411
463
    def _unlock(self, token):
412
464
        path = self.bzrdir._path_for_remote_call(self._client)
413
465
        response = self._client.call('Repository.unlock', path, token)
419
471
            raise errors.UnexpectedSmartServerResponse(response)
420
472
 
421
473
    def unlock(self):
 
474
        if self._lock_count == 1 and self._lock_mode == 'w':
 
475
            # don't unlock if inside a write group.
 
476
            if self.is_in_write_group():
 
477
                raise errors.BzrError(
 
478
                    'Must end write groups before releasing write locks.')
422
479
        self._lock_count -= 1
423
480
        if not self._lock_count:
424
481
            mode = self._lock_mode
554
611
        self._ensure_real()
555
612
        return self._real_repository.fileids_altered_by_revision_ids(revision_ids)
556
613
 
 
614
    def iter_files_bytes(self, desired_files):
 
615
        """See Repository.iter_file_bytes.
 
616
        """
 
617
        self._ensure_real()
 
618
        return self._real_repository.iter_files_bytes(desired_files)
 
619
 
557
620
    @needs_read_lock
558
621
    def get_signature_text(self, revision_id):
559
622
        self._ensure_real()
744
807
        assert isinstance(a_bzrdir, RemoteBzrDir)
745
808
        return a_bzrdir.create_branch()
746
809
 
 
810
    def supports_tags(self):
 
811
        # Remote branches might support tags, but we won't know until we
 
812
        # access the real remote branch.
 
813
        return True
 
814
 
747
815
 
748
816
class RemoteBranch(branch.Branch):
749
817
    """Branch stored on a server accessed by HPSS RPC.
1017
1085
        return result
1018
1086
 
1019
1087
    @needs_write_lock
1020
 
    def append_revision(self, *revision_ids):
1021
 
        self._ensure_real()
1022
 
        return self._real_branch.append_revision(*revision_ids)
1023
 
 
1024
 
    @needs_write_lock
1025
1088
    def pull(self, source, overwrite=False, stop_revision=None,
1026
1089
             **kwargs):
1027
1090
        # FIXME: This asks the real branch to run the hooks, which means