128
130
return list(self.get_branches().values())
130
def branch_names(self):
131
"""List all branch names in this control directory.
133
:return: List of branch names
136
self.get_branch_reference()
137
except (errors.NotBranchError, errors.NoRepositoryPresent):
142
132
def get_branches(self):
143
133
"""Get all branches in this control directory, as a dictionary.
410
400
raise NotImplementedError(self.sprout)
412
402
def push_branch(self, source, revision_id=None, overwrite=False,
413
remember=False, create_prefix=False, lossy=False,
403
remember=False, create_prefix=False, lossy=False):
415
404
"""Push the source branch into this ControlDir."""
417
406
# If we can open a branch, use its direct repository, otherwise see
436
425
revision_id = source.last_revision()
437
426
repository_to.fetch(source.repository, revision_id=revision_id)
438
br_to = source.sprout(
439
self, revision_id=revision_id, lossy=lossy,
440
tag_selector=tag_selector)
427
br_to = source.sprout(self, revision_id=revision_id, lossy=lossy)
441
428
if source.get_push_location() is None or remember:
442
429
# FIXME: Should be done only if we succeed ? -- vila 2012-01-18
443
430
source.set_push_location(br_to.base)
457
444
tree_to = self.open_workingtree()
458
445
except errors.NotLocalUrl:
459
446
push_result.branch_push_result = source.push(
460
br_to, overwrite, stop_revision=revision_id, lossy=lossy,
461
tag_selector=tag_selector)
447
br_to, overwrite, stop_revision=revision_id, lossy=lossy)
462
448
push_result.workingtree_updated = False
463
449
except errors.NoWorkingTree:
464
450
push_result.branch_push_result = source.push(
465
br_to, overwrite, stop_revision=revision_id, lossy=lossy,
466
tag_selector=tag_selector)
451
br_to, overwrite, stop_revision=revision_id, lossy=lossy)
467
452
push_result.workingtree_updated = None # Not applicable
469
454
with tree_to.lock_write():
470
455
push_result.branch_push_result = source.push(
471
456
tree_to.branch, overwrite, stop_revision=revision_id,
472
lossy=lossy, tag_selector=tag_selector)
474
459
push_result.workingtree_updated = True
475
460
push_result.old_revno = push_result.branch_push_result.old_revno
508
493
raise NotImplementedError(self.check_conversion_target)
510
495
def clone(self, url, revision_id=None, force_new_repo=False,
511
preserve_stacking=False, tag_selector=None):
496
preserve_stacking=False):
512
497
"""Clone this controldir and its contents to url verbatim.
514
499
:param url: The url create the clone at. If url's last component does
524
509
return self.clone_on_transport(_mod_transport.get_transport(url),
525
510
revision_id=revision_id,
526
511
force_new_repo=force_new_repo,
527
preserve_stacking=preserve_stacking,
528
tag_selector=tag_selector)
512
preserve_stacking=preserve_stacking)
530
514
def clone_on_transport(self, transport, revision_id=None,
531
515
force_new_repo=False, preserve_stacking=False, stacked_on=None,
532
create_prefix=False, use_existing_dir=True, no_tree=False,
516
create_prefix=False, use_existing_dir=True, no_tree=False):
534
517
"""Clone this controldir and its contents to transport verbatim.
536
519
:param transport: The transport for the location to produce the clone
806
789
a_transport = new_t
809
def open_tree_or_branch(klass, location, name=None):
792
def open_tree_or_branch(klass, location):
810
793
"""Return the branch and working tree at a location.
812
795
If there is no tree at the location, tree will be None.
815
798
:return: (tree, branch)
817
800
controldir = klass.open(location)
818
return controldir._get_tree_branch(name=name)
801
return controldir._get_tree_branch()
821
804
def open_containing_tree_or_branch(klass, location,