~ubuntu-branches/ubuntu/raring/bzr-svn/raring

« back to all changes in this revision

Viewing changes to remote.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-07-30 23:14:36 UTC
  • mfrom: (1.1.28 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100730231436-po8j0ibgjn2d6hy0
Tags: 1.0.3-1
* New upstream release.
 + Provides BranchConfig._get_change_editor. Closes: #572109
 + Supports more trunk layout levels. Closes: #573988
* Bump standards version to 3.9.1.
* Mark as supporting bzr 2.2.
* Suggest bzr-rewrite rather than bzr-rebase. LP: #481730

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
 
21
21
from bzrlib import (
 
22
    errors,
22
23
    trace,
23
24
    )
24
25
from bzrlib.bzrdir import (
25
26
    BzrDirFormat,
26
27
    BzrDir,
27
 
    )
28
 
from bzrlib.errors import (
29
 
    AlreadyBranchError,
30
 
    NotBranchError,
31
 
    NotLocalUrl,
32
 
    NoWorkingTree,
 
28
    format_registry,
33
29
    )
34
30
from bzrlib.revision import (
35
31
    NULL_REVISION,
44
40
    )
45
41
from bzrlib.plugins.svn.format import (
46
42
    SvnRemoteFormat,
47
 
    get_rich_root_format,
48
43
    )
49
44
from bzrlib.plugins.svn.repository import (
50
45
    SvnRepository,
97
92
        self.svn_root_url = _transport.get_svn_repos_root()
98
93
        self.root_url = _transport.get_repos_root()
99
94
 
100
 
        assert svn_url.startswith(self.svn_root_url)
 
95
        assert svn_url.lower().startswith(self.svn_root_url.lower())
101
96
        self.branch_path = svn_url[len(self.svn_root_url):]
102
97
 
103
98
    def clone(self, url, revision_id=None, force_new_repo=False):
143
138
 
144
139
    def cloning_metadir(self, require_stacking=False):
145
140
        """Produce a metadir suitable for cloning with."""
146
 
        return get_rich_root_format(require_stacking)
 
141
        return format_registry.make_bzrdir('default')
147
142
 
148
143
    def open_workingtree(self, _unsupported=False,
149
144
            recommend_upgrade=True):
153
148
        BzrDir can not be associated with working trees.
154
149
        """
155
150
        # Working trees never exist on remote Subversion repositories
156
 
        raise NoWorkingTree(self.root_transport.base)
 
151
        raise errors.NoWorkingTree(self.root_transport.base)
157
152
 
158
153
    def create_workingtree(self, revision_id=None, hardlink=None):
159
154
        """See BzrDir.create_workingtree().
161
156
        Will always raise NotLocalUrl as this
162
157
        BzrDir can not be associated with working trees.
163
158
        """
164
 
        raise NotLocalUrl(self.root_transport.base)
 
159
        raise errors.NotLocalUrl(self.root_transport.base)
165
160
 
166
161
    def needs_format_conversion(self, format=None):
167
162
        """See BzrDir.needs_format_conversion()."""
194
189
                try:
195
190
                    (type, project, _, ip) = layout.parse(target_branch_path)
196
191
                except NotSvnBranchPath:
197
 
                    raise NotBranchError(target_branch_path)
 
192
                    raise errors.NotBranchError(target_branch_path)
198
193
                if type not in ('branch', 'tag') or ip != '':
199
 
                    raise NotBranchError(target_branch_path)
 
194
                    raise errors.NotBranchError(target_branch_path)
200
195
                inter.push_new_branch(layout, project, target_branch_path,
201
196
                        stop_revision,
202
197
                        override_svn_revprops=_override_svn_revprops,
217
212
            repos.transport.mkdir(self.branch_path.strip("/"))
218
213
        elif repos.get_latest_revnum() > 0:
219
214
            # Bail out if there are already revisions in this repository
220
 
            raise AlreadyBranchError(self.root_transport.base)
 
215
            raise errors.AlreadyBranchError(self.root_transport.base)
221
216
        branch = SvnBranch(repos, self.branch_path)
222
217
        branch.bzrdir = self
223
218
        return branch
224
219
 
225
 
    def open_branch(self, unsupported=True, ignore_fallbacks=False):
 
220
    def open_branch(self, unsupported=True, name=None, ignore_fallbacks=False):
226
221
        """See BzrDir.open_branch()."""
227
222
        from bzrlib.plugins.svn.branch import SvnBranch
 
223
        if name is not None:
 
224
            raise errors.NoColocatedBranchSupport(self)
228
225
        repos = self.find_repository()
229
226
        branch = SvnBranch(repos, self.branch_path)
230
227
        branch.bzrdir = self
253
250
                    overwrite=overwrite)
254
251
            finally:
255
252
                target_branch.unlock()
256
 
        except NotBranchError:
 
253
        except errors.NotBranchError:
257
254
            ret.target_branch_path = "/%s" % self.branch_path.lstrip("/")
258
255
            if create_prefix:
259
256
                self.root_transport.create_prefix()