128
128
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
130
def get_branches(self):
143
131
"""Get all branches in this control directory, as a dictionary.
410
398
raise NotImplementedError(self.sprout)
412
400
def push_branch(self, source, revision_id=None, overwrite=False,
413
remember=False, create_prefix=False, lossy=False,
401
remember=False, create_prefix=False, lossy=False):
415
402
"""Push the source branch into this ControlDir."""
417
404
# If we can open a branch, use its direct repository, otherwise see
436
423
revision_id = source.last_revision()
437
424
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)
425
br_to = source.sprout(self, revision_id=revision_id, lossy=lossy)
441
426
if source.get_push_location() is None or remember:
442
427
# FIXME: Should be done only if we succeed ? -- vila 2012-01-18
443
428
source.set_push_location(br_to.base)
457
442
tree_to = self.open_workingtree()
458
443
except errors.NotLocalUrl:
459
444
push_result.branch_push_result = source.push(
460
br_to, overwrite, stop_revision=revision_id, lossy=lossy,
461
tag_selector=tag_selector)
445
br_to, overwrite, stop_revision=revision_id, lossy=lossy)
462
446
push_result.workingtree_updated = False
463
447
except errors.NoWorkingTree:
464
448
push_result.branch_push_result = source.push(
465
br_to, overwrite, stop_revision=revision_id, lossy=lossy,
466
tag_selector=tag_selector)
449
br_to, overwrite, stop_revision=revision_id, lossy=lossy)
467
450
push_result.workingtree_updated = None # Not applicable
469
452
with tree_to.lock_write():
470
453
push_result.branch_push_result = source.push(
471
454
tree_to.branch, overwrite, stop_revision=revision_id,
472
lossy=lossy, tag_selector=tag_selector)
474
457
push_result.workingtree_updated = True
475
458
push_result.old_revno = push_result.branch_push_result.old_revno
508
491
raise NotImplementedError(self.check_conversion_target)
510
493
def clone(self, url, revision_id=None, force_new_repo=False,
511
preserve_stacking=False, tag_selector=None):
494
preserve_stacking=False):
512
495
"""Clone this controldir and its contents to url verbatim.
514
497
:param url: The url create the clone at. If url's last component does
524
507
return self.clone_on_transport(_mod_transport.get_transport(url),
525
508
revision_id=revision_id,
526
509
force_new_repo=force_new_repo,
527
preserve_stacking=preserve_stacking,
528
tag_selector=tag_selector)
510
preserve_stacking=preserve_stacking)
530
512
def clone_on_transport(self, transport, revision_id=None,
531
513
force_new_repo=False, preserve_stacking=False, stacked_on=None,
532
create_prefix=False, use_existing_dir=True, no_tree=False,
514
create_prefix=False, use_existing_dir=True, no_tree=False):
534
515
"""Clone this controldir and its contents to transport verbatim.
536
517
:param transport: The transport for the location to produce the clone
806
787
a_transport = new_t
809
def open_tree_or_branch(klass, location, name=None):
790
def open_tree_or_branch(klass, location):
810
791
"""Return the branch and working tree at a location.
812
793
If there is no tree at the location, tree will be None.
815
796
:return: (tree, branch)
817
798
controldir = klass.open(location)
818
return controldir._get_tree_branch(name=name)
799
return controldir._get_tree_branch()
821
802
def open_containing_tree_or_branch(klass, location,