/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-18 01:57:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7493.
  • Revision ID: jelmer@jelmer.uk-20200218015745-q2ss9tsk74h4nh61
drop use of future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        """
128
128
        return list(self.get_branches().values())
129
129
 
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
130
    def get_branches(self):
143
131
        """Get all branches in this control directory, as a dictionary.
144
132
 
410
398
        raise NotImplementedError(self.sprout)
411
399
 
412
400
    def push_branch(self, source, revision_id=None, overwrite=False,
413
 
                    remember=False, create_prefix=False, lossy=False,
414
 
                    tag_selector=None):
 
401
                    remember=False, create_prefix=False, lossy=False):
415
402
        """Push the source branch into this ControlDir."""
416
403
        br_to = None
417
404
        # If we can open a branch, use its direct repository, otherwise see
435
422
                # revision
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
468
451
            else:
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)
 
455
                        lossy=lossy)
473
456
                    tree_to.update()
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)
509
492
 
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.
513
496
 
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)
529
511
 
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,
533
 
                           tag_selector=None):
 
514
                           create_prefix=False, use_existing_dir=True, no_tree=False):
534
515
        """Clone this controldir and its contents to transport verbatim.
535
516
 
536
517
        :param transport: The transport for the location to produce the clone
806
787
            a_transport = new_t
807
788
 
808
789
    @classmethod
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.
811
792
 
812
793
        If there is no tree at the location, tree will be None.
815
796
        :return: (tree, branch)
816
797
        """
817
798
        controldir = klass.open(location)
818
 
        return controldir._get_tree_branch(name=name)
 
799
        return controldir._get_tree_branch()
819
800
 
820
801
    @classmethod
821
802
    def open_containing_tree_or_branch(klass, location,