196
201
def break_lock(self):
199
def clone(self, url, revision_id=None, force_new_repo=False):
200
"""See ControlDir.clone().
204
def clone_on_transport(self, transport, revision_id=None,
205
force_new_repo=False, preserve_stacking=False, stacked_on=None,
206
create_prefix=False, use_existing_dir=True, no_tree=False):
207
"""Clone this bzrdir and its contents to transport verbatim.
202
Not supported on Subversion connections.
209
:param transport: The transport for the location to produce the clone
210
at. If the target directory does not exist, it will be created.
211
:param revision_id: The tip revision-id to use for any branch or
212
working tree. If not None, then the clone operation may tune
213
itself to download less data.
214
:param force_new_repo: Do not use a shared repository for the target,
215
even if one is available.
216
:param preserve_stacking: When cloning a stacked branch, stack the
217
new branch on top of the other branch's stacked-on branch.
218
:param create_prefix: Create any missing directories leading up to
220
:param use_existing_dir: Use an existing directory if one exists.
221
:param no_tree: If set to true prevents creation of a working tree.
204
raise NotImplementedError(SvnRemoteAccess.clone)
224
transport.create_prefix()
225
if not use_existing_dir:
227
target = SvnRemoteFormat().initialize_on_transport(transport)
228
target_repo = target.open_repository()
229
source_repo = self.open_repository()
230
target_repo.fetch(source_repo, revision_id=revision_id)
206
233
def sprout(self, url, revision_id=None, force_new_repo=False,
207
234
recurse='down', possible_transports=None,
337
367
from bzrlib.plugins.svn.errors import NoCustomBranchPaths
338
368
repos = self.find_repository()
339
369
layout = repos.get_layout()
370
if branch_name is None and getattr(self, "_get_selected_branch", False):
371
branch_name = self._get_selected_branch()
340
372
if branch_name is None and layout.is_branch_or_tag(self._branch_path):
341
373
return self._branch_path
375
if branch_name is not None:
376
branch_name = osutils.safe_utf8(branch_name)
343
377
return layout.get_branch_path(branch_name, self._branch_path)
344
378
except NoCustomBranchPaths:
345
raise errors.NoColocatedBranchSupport(self)
379
if branch_name is None:
380
return self._branch_path
382
raise errors.NoColocatedBranchSupport(layout)
347
384
def create_branch(self, branch_name=None, repository=None, mapping=None):
348
385
"""See ControlDir.create_branch()."""
349
386
from bzrlib.plugins.svn.branch import SvnBranch
387
from bzrlib.plugins.svn.push import (
389
create_branch_container,
390
create_branch_with_hidden_commit,
350
392
if repository is None:
351
393
repository = self.find_repository()
353
relpath = self._determine_relpath(branch_name)
396
mapping = repository.get_mapping()
398
relpath = self._determine_relpath(branch_name).strip("/")
400
if repository.get_latest_revnum() > 0:
401
# Bail out if there are already revisions in this repository
402
raise errors.AlreadyBranchError(repository.transport.base)
403
# TODO: Set NULL_REVISION in SVN_PROP_BZR_BRANCHING_SCHEME on rev0
404
bp_parts = relpath.split("/")
405
existing_bp_parts = check_dirs_exist(repository.transport, bp_parts,
407
if len(existing_bp_parts) == len(bp_parts) and relpath != "":
408
raise errors.AlreadyBranchError(repository.transport.base)
409
if len(existing_bp_parts) < len(bp_parts)-1:
410
create_branch_container(repository.transport, relpath, "/".join(existing_bp_parts))
354
411
if relpath != "":
355
# TODO: Set NULL_REVISION in SVN_PROP_BZR_BRANCHING_SCHEME
356
repository.transport.mkdir(relpath.strip("/"))
357
elif repository.get_latest_revnum() > 0:
358
# Bail out if there are already revisions in this repository
359
raise errors.AlreadyBranchError(self.root_transport.base)
361
mapping = repository.get_mapping()
412
create_branch_with_hidden_commit(repository, relpath, NULL_REVISION)
362
413
return SvnBranch(repository, self, relpath, mapping)
364
415
def open_branch(self, name=None, unsupported=True, ignore_fallbacks=False,
416
mapping=None, branch_path=None, repository=None):
366
417
"""See ControlDir.open_branch()."""
367
418
from bzrlib.plugins.svn.branch import SvnBranch
368
relpath = self._determine_relpath(name)
369
repos = self.find_repository()
419
if branch_path is None:
420
branch_path = self._determine_relpath(name)
421
if repository is None:
422
repository = self.find_repository()
370
423
if mapping is None:
371
mapping = repos.get_mapping()
372
return SvnBranch(repos, self, relpath, mapping)
424
mapping = repository.get_mapping()
425
return SvnBranch(repository, self, branch_path, mapping)
374
427
def create_repository(self, shared=False, format=None):
375
428
"""See ControlDir.create_repository."""
376
429
return self.open_repository()
378
431
def push_branch(self, source, revision_id=None, overwrite=False,
379
remember=False, create_prefix=False):
432
remember=False, create_prefix=False, name=None):
380
433
ret = SubversionPushResult()
381
434
ret.source_branch = source
382
435
ret.workingtree_updated = None
383
436
ret.stacked_on = None
384
437
ret.master_branch = None
386
target_branch = self.open_branch()
439
target_branch = self.open_branch(name=name)
387
440
if source.get_push_location() is None or remember:
388
441
source.set_push_location(target_branch.base)
389
442
ret.target_branch = target_branch