~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

(vila) Fix bzrlib.tests.test_gpg.TestVerify.test_verify_revoked_signature
 with recent versions of gpg. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
            self._real_store = _mod_config.ControlStore(self.bzrdir)
385
385
 
386
386
    def external_url(self):
387
 
        return self.bzrdir.user_url
 
387
        return urlutils.join(self.branch.user_url, 'control.conf')
388
388
 
389
389
    def _load_content(self):
390
390
        medium = self.bzrdir._client._medium
2160
2160
        self._ensure_real()
2161
2161
        self._real_repository.create_bundle(target, base, fileobj, format)
2162
2162
 
2163
 
    @needs_read_lock
2164
 
    @symbol_versioning.deprecated_method(
2165
 
        symbol_versioning.deprecated_in((2, 4, 0)))
2166
 
    def get_ancestry(self, revision_id, topo_sorted=True):
2167
 
        self._ensure_real()
2168
 
        return self._real_repository.get_ancestry(revision_id, topo_sorted)
2169
 
 
2170
2163
    def fileids_altered_by_revision_ids(self, revision_ids):
2171
2164
        self._ensure_real()
2172
2165
        return self._real_repository.fileids_altered_by_revision_ids(revision_ids)
2709
2702
    def supports_rich_root(self):
2710
2703
        return self._format.rich_root_data
2711
2704
 
2712
 
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
2713
 
    def iter_reverse_revision_history(self, revision_id):
2714
 
        self._ensure_real()
2715
 
        return self._real_repository.iter_reverse_revision_history(revision_id)
2716
 
 
2717
2705
    @property
2718
2706
    def _serializer(self):
2719
2707
        return self._format._serializer
3129
3117
        return a_bzrdir.open_branch(name=name, 
3130
3118
            ignore_fallbacks=ignore_fallbacks)
3131
3119
 
3132
 
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only):
 
3120
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only,
 
3121
                        repository=None):
3133
3122
        # Initialisation when using a local bzrdir object, or a non-vfs init
3134
3123
        # method is not available on the server.
3135
3124
        # self._custom_format is always set - the start of initialize ensures
3137
3126
        if isinstance(a_bzrdir, RemoteBzrDir):
3138
3127
            a_bzrdir._ensure_real()
3139
3128
            result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
3140
 
                name=name, append_revisions_only=append_revisions_only)
 
3129
                name=name, append_revisions_only=append_revisions_only,
 
3130
                repository=repository)
3141
3131
        else:
3142
3132
            # We assume the bzrdir is parameterised; it may not be.
3143
3133
            result = self._custom_format.initialize(a_bzrdir, name=name,
3144
 
                append_revisions_only=append_revisions_only)
 
3134
                append_revisions_only=append_revisions_only,
 
3135
                repository=repository)
3145
3136
        if (isinstance(a_bzrdir, RemoteBzrDir) and
3146
3137
            not isinstance(result, RemoteBranch)):
3147
3138
            result = RemoteBranch(a_bzrdir, a_bzrdir.find_repository(), result,
3164
3155
        # Being asked to create on a non RemoteBzrDir:
3165
3156
        if not isinstance(a_bzrdir, RemoteBzrDir):
3166
3157
            return self._vfs_initialize(a_bzrdir, name=name,
3167
 
                append_revisions_only=append_revisions_only)
 
3158
                append_revisions_only=append_revisions_only,
 
3159
                repository=repository)
3168
3160
        medium = a_bzrdir._client._medium
3169
3161
        if medium._is_remote_before((1, 13)):
3170
3162
            return self._vfs_initialize(a_bzrdir, name=name,
3171
 
                append_revisions_only=append_revisions_only)
 
3163
                append_revisions_only=append_revisions_only,
 
3164
                repository=repository)
3172
3165
        # Creating on a remote bzr dir.
3173
3166
        # 2) try direct creation via RPC
3174
3167
        path = a_bzrdir._path_for_remote_call(a_bzrdir._client)
3182
3175
            # Fallback - use vfs methods
3183
3176
            medium._remember_remote_is_before((1, 13))
3184
3177
            return self._vfs_initialize(a_bzrdir, name=name,
3185
 
                    append_revisions_only=append_revisions_only)
 
3178
                    append_revisions_only=append_revisions_only,
 
3179
                    repository=repository)
3186
3180
        if response[0] != 'ok':
3187
3181
            raise errors.UnexpectedSmartServerResponse(response)
3188
3182
        # Turn the response into a RemoteRepository object.
3263
3257
        self._real_store = None
3264
3258
 
3265
3259
    def external_url(self):
3266
 
        return self.branch.user_url
 
3260
        return urlutils.join(self.branch.user_url, 'branch.conf')
3267
3261
 
3268
3262
    def _load_content(self):
3269
3263
        path = self.branch._remote_path()
3405
3399
            self.conf_store =  RemoteBranchStore(self)
3406
3400
        return self.conf_store
3407
3401
 
 
3402
    def store_uncommitted(self, creator):
 
3403
        self._ensure_real()
 
3404
        return self._real_branch.store_uncommitted(creator)
 
3405
 
 
3406
    def get_unshelver(self, tree):
 
3407
        self._ensure_real()
 
3408
        return self._real_branch.get_unshelver(tree)
 
3409
 
3408
3410
    def _get_real_transport(self):
3409
3411
        # if we try vfs access, return the real branch's vfs transport
3410
3412
        self._ensure_real()
3792
3794
            raise errors.UnexpectedSmartServerResponse(response)
3793
3795
        self._run_post_change_branch_tip_hooks(old_revno, old_revid)
3794
3796
 
3795
 
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4, 0)))
3796
 
    @needs_write_lock
3797
 
    def set_revision_history(self, rev_history):
3798
 
        """See Branch.set_revision_history."""
3799
 
        self._set_revision_history(rev_history)
3800
 
 
3801
 
    @needs_write_lock
3802
 
    def _set_revision_history(self, rev_history):
3803
 
        # Send just the tip revision of the history; the server will generate
3804
 
        # the full history from that.  If the revision doesn't exist in this
3805
 
        # branch, NoSuchRevision will be raised.
3806
 
        if rev_history == []:
3807
 
            rev_id = 'null:'
3808
 
        else:
3809
 
            rev_id = rev_history[-1]
3810
 
        self._set_last_revision(rev_id)
3811
 
        for hook in branch.Branch.hooks['set_rh']:
3812
 
            hook(self, rev_history)
3813
 
        self._cache_revision_history(rev_history)
3814
 
 
3815
3797
    def _get_parent_location(self):
3816
3798
        medium = self._client._medium
3817
3799
        if medium._is_remote_before((1, 13)):
3869
3851
            target, overwrite=overwrite, stop_revision=stop_revision, lossy=lossy,
3870
3852
            _override_hook_source_branch=self)
3871
3853
 
 
3854
    def peek_lock_mode(self):
 
3855
        return self._lock_mode
 
3856
 
3872
3857
    def is_locked(self):
3873
3858
        return self._lock_count >= 1
3874
3859
 
3949
3934
            except errors.UnknownSmartMethod:
3950
3935
                medium._remember_remote_is_before((1, 6))
3951
3936
        self._clear_cached_state_of_remote_branch_only()
3952
 
        self._set_revision_history(self._lefthand_history(revision_id,
3953
 
            last_rev=last_rev,other_branch=other_branch))
 
3937
        graph = self.repository.get_graph()
 
3938
        (last_revno, last_revid) = self.last_revision_info()
 
3939
        known_revision_ids = [
 
3940
            (last_revid, last_revno),
 
3941
            (_mod_revision.NULL_REVISION, 0),
 
3942
            ]
 
3943
        if last_rev is not None:
 
3944
            if not graph.is_ancestor(last_rev, revision_id):
 
3945
                # our previous tip is not merged into stop_revision
 
3946
                raise errors.DivergedBranches(self, other_branch)
 
3947
        revno = graph.find_distance_to_null(revision_id, known_revision_ids)
 
3948
        self.set_last_revision_info(revno, revision_id)
3954
3949
 
3955
3950
    def set_push_location(self, location):
3956
3951
        self._set_config_location('push_location', location)