~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-01-29 17:54:08 UTC
  • mto: This revision was merged to the branch mainline in revision 5040.
  • Revision ID: jelmer@samba.org-20100129175408-rn80rnkg0qplyni9
RemoveĀ unusedĀ imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
    BzrDir,
23
23
    BzrDirFormat,
24
24
    BzrDirMetaFormat1,
25
 
    BzrProber,
26
 
    )
27
 
from bzrlib.controldir import (
28
25
    network_format_registry,
29
26
    )
30
27
from bzrlib.smart.request import (
47
44
            # clients that don't anticipate errors from this method.
48
45
            answer = 'no'
49
46
        else:
50
 
            bzr_prober = BzrProber()
 
47
            default_format = BzrDirFormat.get_default_format()
 
48
            real_bzrdir = default_format.open(t, _found=True)
51
49
            try:
52
 
                bzr_prober.probe_transport(t)
 
50
                real_bzrdir._format.probe_transport(t)
53
51
            except (errors.NotBranchError, errors.UnknownFormatError):
54
52
                answer = 'no'
55
53
            else:
86
84
class SmartServerRequestBzrDir(SmartServerRequest):
87
85
 
88
86
    def do(self, path, *args):
89
 
        """Open a BzrDir at path, and return `self.do_bzrdir_request(*args)`."""
 
87
        """Open a BzrDir at path, and return self.do_bzrdir_request(*args)."""
90
88
        try:
91
89
            self._bzrdir = BzrDir.open_from_transport(
92
90
                self.transport_from_client_path(path))
112
110
        """Get the relative path for repository from current_transport."""
113
111
        # the relpath of the bzrdir in the found repository gives us the
114
112
        # path segments to pop-out.
115
 
        relpath = repository.user_transport.relpath(
 
113
        relpath = repository.bzrdir.root_transport.relpath(
116
114
            current_transport.base)
117
115
        if len(relpath):
118
116
            segments = ['..'] * len(relpath.split('/'))
181
179
 
182
180
        :param path: The path to the bzrdir.
183
181
        :param network_name: The network name of the branch type to create.
184
 
        :return: ('ok', branch_format, repo_path, rich_root, tree_ref,
185
 
            external_lookup, repo_format)
 
182
        :return: (ok, network_name)
186
183
        """
187
184
        bzrdir = BzrDir.open_from_transport(
188
185
            self.transport_from_client_path(path))
432
429
            # It is returned locked, but we need to do the lock to get the lock
433
430
            # token.
434
431
            repo.unlock()
435
 
            repo_lock_token = repo.lock_write().repository_token or ''
 
432
            repo_lock_token = repo.lock_write() or ''
436
433
            if repo_lock_token:
437
434
                repo.leave_lock_in_place()
438
435
            repo.unlock()