/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 breezy/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import bz2
20
20
import zlib
21
21
 
22
 
from brzlib import (
 
22
from breezy import (
23
23
    bencode,
24
24
    branch,
25
25
    bzrdir as _mod_bzrdir,
43
43
    vf_repository,
44
44
    vf_search,
45
45
    )
46
 
from brzlib.branch import BranchReferenceFormat, BranchWriteLockResult
47
 
from brzlib.decorators import needs_read_lock, needs_write_lock, only_raises
48
 
from brzlib.errors import (
 
46
from breezy.branch import BranchReferenceFormat, BranchWriteLockResult
 
47
from breezy.decorators import needs_read_lock, needs_write_lock, only_raises
 
48
from breezy.errors import (
49
49
    NoSuchRevision,
50
50
    SmartProtocolError,
51
51
    )
52
 
from brzlib.i18n import gettext
53
 
from brzlib.inventory import Inventory
54
 
from brzlib.lockable_files import LockableFiles
55
 
from brzlib.smart import client, vfs, repository as smart_repo
56
 
from brzlib.smart.client import _SmartClient
57
 
from brzlib.revision import NULL_REVISION
58
 
from brzlib.revisiontree import InventoryRevisionTree
59
 
from brzlib.repository import RepositoryWriteLockResult, _LazyListJoin
60
 
from brzlib.serializer import format_registry as serializer_format_registry
61
 
from brzlib.trace import mutter, note, warning, log_exception_quietly
62
 
from brzlib.versionedfile import FulltextContentFactory
 
52
from breezy.i18n import gettext
 
53
from breezy.inventory import Inventory
 
54
from breezy.lockable_files import LockableFiles
 
55
from breezy.smart import client, vfs, repository as smart_repo
 
56
from breezy.smart.client import _SmartClient
 
57
from breezy.revision import NULL_REVISION
 
58
from breezy.revisiontree import InventoryRevisionTree
 
59
from breezy.repository import RepositoryWriteLockResult, _LazyListJoin
 
60
from breezy.serializer import format_registry as serializer_format_registry
 
61
from breezy.trace import mutter, note, warning, log_exception_quietly
 
62
from breezy.versionedfile import FulltextContentFactory
63
63
 
64
64
 
65
65
_DEFAULT_SEARCH_DEPTH = 100
105
105
    return format
106
106
 
107
107
 
108
 
# Note that RemoteBzrDirProber lives in brzlib.bzrdir so brzlib.remote
 
108
# Note that RemoteBzrDirProber lives in breezy.bzrdir so breezy.remote
109
109
# does not have to be imported unless a remote format is involved.
110
110
 
111
111
class RemoteBzrDirFormat(_mod_bzrdir.BzrDirMetaFormat1):
1050
1050
        elif self._network_name:
1051
1051
            network_name = self._network_name
1052
1052
        else:
1053
 
            # Select the current brzlib default and ask for that.
 
1053
            # Select the current breezy default and ask for that.
1054
1054
            reference_bzrdir_format = controldir.format_registry.get('default')()
1055
1055
            reference_format = reference_bzrdir_format.repository_format
1056
1056
            network_name = reference_format.network_name()
1408
1408
    @needs_read_lock
1409
1409
    def has_revision(self, revision_id):
1410
1410
        """True if this repository has a copy of the revision."""
1411
 
        # Copy of brzlib.repository.Repository.has_revision
 
1411
        # Copy of breezy.repository.Repository.has_revision
1412
1412
        return revision_id in self.has_revisions((revision_id,))
1413
1413
 
1414
1414
    @needs_read_lock
1418
1418
        :param revision_ids: An iterable of revision_ids.
1419
1419
        :return: A set of the revision_ids that were present.
1420
1420
        """
1421
 
        # Copy of brzlib.repository.Repository.has_revisions
 
1421
        # Copy of breezy.repository.Repository.has_revisions
1422
1422
        parent_map = self.get_parent_map(revision_ids)
1423
1423
        result = set(parent_map)
1424
1424
        if _mod_revision.NULL_REVISION in revision_ids:
1540
1540
    def lock_read(self):
1541
1541
        """Lock the repository for read operations.
1542
1542
 
1543
 
        :return: A brzlib.lock.LogicalLockResult.
 
1543
        :return: A breezy.lock.LogicalLockResult.
1544
1544
        """
1545
1545
        # wrong eventually - want a local lock cache context
1546
1546
        if not self._lock_mode:
2075
2075
        This method is intended to be called after another repository instance
2076
2076
        (such as one used by a smart server) has inserted data into the
2077
2077
        repository. On all repositories this will work outside of write groups.
2078
 
        Some repository formats (pack and newer for brzlib native formats)
 
2078
        Some repository formats (pack and newer for breezy native formats)
2079
2079
        support refresh_data inside write groups. If called inside a write
2080
2080
        group on a repository that does not support refreshing in a write group
2081
2081
        IsInWriteGroupError will be raised.
2245
2245
                yield identifier, bytes_iterator
2246
2246
 
2247
2247
    def get_cached_parent_map(self, revision_ids):
2248
 
        """See brzlib.CachingParentsProvider.get_cached_parent_map"""
 
2248
        """See breezy.CachingParentsProvider.get_cached_parent_map"""
2249
2249
        return self._unstacked_provider.get_cached_parent_map(revision_ids)
2250
2250
 
2251
2251
    def get_parent_map(self, revision_ids):
2252
 
        """See brzlib.Graph.get_parent_map()."""
 
2252
        """See breezy.Graph.get_parent_map()."""
2253
2253
        return self._make_parents_provider().get_parent_map(revision_ids)
2254
2254
 
2255
2255
    def _get_parent_map_rpc(self, keys):
2402
2402
 
2403
2403
    @needs_write_lock
2404
2404
    def reconcile(self, other=None, thorough=False):
2405
 
        from brzlib.reconcile import RepoReconciler
 
2405
        from breezy.reconcile import RepoReconciler
2406
2406
        path = self.bzrdir._path_for_remote_call(self._client)
2407
2407
        try:
2408
2408
            response, handler = self._call_expecting_body(
3147
3147
        if self._custom_format:
3148
3148
            network_name = self._custom_format.network_name()
3149
3149
        else:
3150
 
            # Select the current brzlib default and ask for that.
 
3150
            # Select the current breezy default and ask for that.
3151
3151
            reference_bzrdir_format = controldir.format_registry.get('default')()
3152
3152
            reference_format = reference_bzrdir_format.get_branch_format()
3153
3153
            self._custom_format = reference_format
3335
3335
            self._real_branch.repository = self.repository
3336
3336
        else:
3337
3337
            self._real_branch = None
3338
 
        # Fill out expected attributes of branch for brzlib API users.
 
3338
        # Fill out expected attributes of branch for breezy API users.
3339
3339
        self._clear_cached_state()
3340
3340
        # TODO: deprecate self.base in favor of user_url
3341
3341
        self.base = self.bzrdir.user_url
3521
3521
        # We need the stacked_on_url to be visible both locally (to not query
3522
3522
        # it repeatedly) and remotely (so smart verbs can get it server side)
3523
3523
        # Without the following line,
3524
 
        # brzlib.tests.per_branch.test_create_clone.TestCreateClone
 
3524
        # breezy.tests.per_branch.test_create_clone.TestCreateClone
3525
3525
        # .test_create_clone_on_transport_stacked_hooks_get_stacked_branch
3526
3526
        # fails for remote branches -- vila 2012-01-04
3527
3527
        self.conf_store.save_changes()
3574
3574
    def lock_read(self):
3575
3575
        """Lock the branch for read operations.
3576
3576
 
3577
 
        :return: A brzlib.lock.LogicalLockResult.
 
3577
        :return: A breezy.lock.LogicalLockResult.
3578
3578
        """
3579
3579
        self.repository.lock_read()
3580
3580
        if not self._lock_mode:
3983
3983
 
3984
3984
    It is a low-level object that considers config data to be name/value pairs
3985
3985
    that may be associated with a section. Assigning meaning to the these
3986
 
    values is done at higher levels like brzlib.config.TreeConfig.
 
3986
    values is done at higher levels like breezy.config.TreeConfig.
3987
3987
    """
3988
3988
 
3989
3989
    def get_option(self, name, section=None, default=None):