~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: John Arbash Meinel
  • Date: 2012-09-19 07:58:27 UTC
  • mfrom: (6437.63.9 2.5)
  • mto: This revision was merged to the branch mainline in revision 6563.
  • Revision ID: john@arbash-meinel.com-20120919075827-36b2b042kiaps0d3
Merge bzr-2.5.2 into trunk to get the fixes for ConnectionReset.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3117
3117
        return a_bzrdir.open_branch(name=name, 
3118
3118
            ignore_fallbacks=ignore_fallbacks)
3119
3119
 
3120
 
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only):
 
3120
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only,
 
3121
                        repository=None):
3121
3122
        # Initialisation when using a local bzrdir object, or a non-vfs init
3122
3123
        # method is not available on the server.
3123
3124
        # self._custom_format is always set - the start of initialize ensures
3125
3126
        if isinstance(a_bzrdir, RemoteBzrDir):
3126
3127
            a_bzrdir._ensure_real()
3127
3128
            result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
3128
 
                name=name, append_revisions_only=append_revisions_only)
 
3129
                name=name, append_revisions_only=append_revisions_only,
 
3130
                repository=repository)
3129
3131
        else:
3130
3132
            # We assume the bzrdir is parameterised; it may not be.
3131
3133
            result = self._custom_format.initialize(a_bzrdir, name=name,
3132
 
                append_revisions_only=append_revisions_only)
 
3134
                append_revisions_only=append_revisions_only,
 
3135
                repository=repository)
3133
3136
        if (isinstance(a_bzrdir, RemoteBzrDir) and
3134
3137
            not isinstance(result, RemoteBranch)):
3135
3138
            result = RemoteBranch(a_bzrdir, a_bzrdir.find_repository(), result,
3152
3155
        # Being asked to create on a non RemoteBzrDir:
3153
3156
        if not isinstance(a_bzrdir, RemoteBzrDir):
3154
3157
            return self._vfs_initialize(a_bzrdir, name=name,
3155
 
                append_revisions_only=append_revisions_only)
 
3158
                append_revisions_only=append_revisions_only,
 
3159
                repository=repository)
3156
3160
        medium = a_bzrdir._client._medium
3157
3161
        if medium._is_remote_before((1, 13)):
3158
3162
            return self._vfs_initialize(a_bzrdir, name=name,
3159
 
                append_revisions_only=append_revisions_only)
 
3163
                append_revisions_only=append_revisions_only,
 
3164
                repository=repository)
3160
3165
        # Creating on a remote bzr dir.
3161
3166
        # 2) try direct creation via RPC
3162
3167
        path = a_bzrdir._path_for_remote_call(a_bzrdir._client)
3170
3175
            # Fallback - use vfs methods
3171
3176
            medium._remember_remote_is_before((1, 13))
3172
3177
            return self._vfs_initialize(a_bzrdir, name=name,
3173
 
                    append_revisions_only=append_revisions_only)
 
3178
                    append_revisions_only=append_revisions_only,
 
3179
                    repository=repository)
3174
3180
        if response[0] != 'ok':
3175
3181
            raise errors.UnexpectedSmartServerResponse(response)
3176
3182
        # Turn the response into a RemoteRepository object.
3845
3851
            target, overwrite=overwrite, stop_revision=stop_revision, lossy=lossy,
3846
3852
            _override_hook_source_branch=self)
3847
3853
 
 
3854
    def peek_lock_mode(self):
 
3855
        return self._lock_mode
 
3856
 
3848
3857
    def is_locked(self):
3849
3858
        return self._lock_count >= 1
3850
3859