/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/controldir.py

  • Committer: Jelmer Vernooij
  • Date: 2020-02-13 23:57:28 UTC
  • mfrom: (7490 work)
  • mto: This revision was merged to the branch mainline in revision 7492.
  • Revision ID: jelmer@jelmer.uk-20200213235728-m6ds0mm3mbs4y182
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
"""
24
24
 
 
25
from __future__ import absolute_import
 
26
 
25
27
from .lazy_import import lazy_import
26
28
lazy_import(globals(), """
27
29
import textwrap
127
129
        """
128
130
        return list(self.get_branches().values())
129
131
 
130
 
    def branch_names(self):
131
 
        """List all branch names in this control directory.
132
 
 
133
 
        :return: List of branch names
134
 
        """
135
 
        try:
136
 
            self.get_branch_reference()
137
 
        except (errors.NotBranchError, errors.NoRepositoryPresent):
138
 
            return []
139
 
        else:
140
 
            return [""]
141
 
 
142
132
    def get_branches(self):
143
133
        """Get all branches in this control directory, as a dictionary.
144
134
 
410
400
        raise NotImplementedError(self.sprout)
411
401
 
412
402
    def push_branch(self, source, revision_id=None, overwrite=False,
413
 
                    remember=False, create_prefix=False, lossy=False,
414
 
                    tag_selector=None):
 
403
                    remember=False, create_prefix=False, lossy=False):
415
404
        """Push the source branch into this ControlDir."""
416
405
        br_to = None
417
406
        # If we can open a branch, use its direct repository, otherwise see
435
424
                # revision
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
468
453
            else:
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)
 
457
                        lossy=lossy)
473
458
                    tree_to.update()
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)
509
494
 
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.
513
498
 
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)
529
513
 
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,
533
 
                           tag_selector=None):
 
516
                           create_prefix=False, use_existing_dir=True, no_tree=False):
534
517
        """Clone this controldir and its contents to transport verbatim.
535
518
 
536
519
        :param transport: The transport for the location to produce the clone
806
789
            a_transport = new_t
807
790
 
808
791
    @classmethod
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.
811
794
 
812
795
        If there is no tree at the location, tree will be None.
815
798
        :return: (tree, branch)
816
799
        """
817
800
        controldir = klass.open(location)
818
 
        return controldir._get_tree_branch(name=name)
 
801
        return controldir._get_tree_branch()
819
802
 
820
803
    @classmethod
821
804
    def open_containing_tree_or_branch(klass, location,