~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-02 01:44:26 UTC
  • mfrom: (6518 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120402014426-0o5qtysohyl006b2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1051
1051
            network_name = self._network_name
1052
1052
        else:
1053
1053
            # Select the current bzrlib default and ask for that.
1054
 
            reference_bzrdir_format = _mod_bzrdir.format_registry.get('default')()
 
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()
1057
1057
        # 2) try direct creation via RPC
3157
3157
            network_name = self._custom_format.network_name()
3158
3158
        else:
3159
3159
            # Select the current bzrlib default and ask for that.
3160
 
            reference_bzrdir_format = _mod_bzrdir.format_registry.get('default')()
 
3160
            reference_bzrdir_format = controldir.format_registry.get('default')()
3161
3161
            reference_format = reference_bzrdir_format.get_branch_format()
3162
3162
            self._custom_format = reference_format
3163
3163
            network_name = reference_format.network_name()
3792
3792
            raise errors.UnexpectedSmartServerResponse(response)
3793
3793
        self._run_post_change_branch_tip_hooks(old_revno, old_revid)
3794
3794
 
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
3795
    def _get_parent_location(self):
3816
3796
        medium = self._client._medium
3817
3797
        if medium._is_remote_before((1, 13)):
3949
3929
            except errors.UnknownSmartMethod:
3950
3930
                medium._remember_remote_is_before((1, 6))
3951
3931
        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))
 
3932
        graph = self.repository.get_graph()
 
3933
        (last_revno, last_revid) = self.last_revision_info()
 
3934
        known_revision_ids = [
 
3935
            (last_revid, last_revno),
 
3936
            (_mod_revision.NULL_REVISION, 0),
 
3937
            ]
 
3938
        if last_rev is not None:
 
3939
            if not graph.is_ancestor(last_rev, revision_id):
 
3940
                # our previous tip is not merged into stop_revision
 
3941
                raise errors.DivergedBranches(self, other_branch)
 
3942
        revno = graph.find_distance_to_null(revision_id, known_revision_ids)
 
3943
        self.set_last_revision_info(revno, revision_id)
3954
3944
 
3955
3945
    def set_push_location(self, location):
3956
3946
        self._set_config_location('push_location', location)