~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/controldir.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
from bzrlib import (
30
30
    errors,
 
31
    hooks,
31
32
    revision as _mod_revision,
32
33
    transport as _mod_transport,
 
34
    trace,
33
35
    ui,
 
36
    urlutils,
34
37
    )
 
38
from bzrlib.transport import local
35
39
from bzrlib.push import (
36
40
    PushResult,
37
41
    )
38
42
 
 
43
from bzrlib.i18n import gettext
39
44
""")
40
45
 
41
46
from bzrlib import registry
74
79
        return self.user_transport.base
75
80
 
76
81
 
77
 
 
78
82
class ControlDir(ControlComponent):
79
83
    """A control directory.
80
84
 
102
106
        """Return a sequence of all branches local to this control directory.
103
107
 
104
108
        """
 
109
        return self.get_branches().values()
 
110
 
 
111
    def get_branches(self):
 
112
        """Get all branches in this control directory, as a dictionary.
 
113
        
 
114
        :return: Dictionary mapping branch names to instances.
 
115
        """
105
116
        try:
106
 
            return [self.open_branch()]
 
117
           return { None: self.open_branch() }
107
118
        except (errors.NotBranchError, errors.NoRepositoryPresent):
108
 
            return []
 
119
           return {}
109
120
 
110
121
    def is_control_filename(self, filename):
111
122
        """True if filename is the name of a path which is reserved for
145
156
        """Destroy the repository in this ControlDir."""
146
157
        raise NotImplementedError(self.destroy_repository)
147
158
 
148
 
    def create_branch(self, name=None, repository=None):
 
159
    def create_branch(self, name=None, repository=None,
 
160
                      append_revisions_only=None):
149
161
        """Create a branch in this ControlDir.
150
162
 
151
163
        :param name: Name of the colocated branch to create, None for
152
164
            the default branch.
 
165
        :param append_revisions_only: Whether this branch should only allow
 
166
            appending new revisions to its history.
153
167
 
154
168
        The controldirs format will control what branch format is created.
155
169
        For more control see BranchFormatXX.create(a_controldir).
193
207
        """
194
208
        raise NotImplementedError(self.destroy_workingtree_metadata)
195
209
 
 
210
    def find_branch_format(self, name=None):
 
211
        """Find the branch 'format' for this controldir.
 
212
 
 
213
        This might be a synthetic object for e.g. RemoteBranch and SVN.
 
214
        """
 
215
        raise NotImplementedError(self.find_branch_format)
 
216
 
196
217
    def get_branch_reference(self, name=None):
197
218
        """Return the referenced URL for the branch in this controldir.
198
219
 
208
229
        return None
209
230
 
210
231
    def open_branch(self, name=None, unsupported=False,
211
 
                    ignore_fallbacks=False):
 
232
                    ignore_fallbacks=False, possible_transports=None):
212
233
        """Open the branch object at this ControlDir if one is present.
213
234
 
214
 
        If unsupported is True, then no longer supported branch formats can
215
 
        still be opened.
216
 
 
217
 
        TODO: static convenience version of this?
 
235
        :param unsupported: if True, then no longer supported branch formats can
 
236
            still be opened.
 
237
        :param ignore_fallbacks: Whether to open fallback repositories
 
238
        :param possible_transports: Transports to use for opening e.g.
 
239
            fallback repositories.
218
240
        """
219
241
        raise NotImplementedError(self.open_branch)
220
242
 
226
248
        get at a repository.
227
249
 
228
250
        :param _unsupported: a private parameter, not part of the api.
229
 
 
230
 
        TODO: static convenience version of this?
231
251
        """
232
252
        raise NotImplementedError(self.open_repository)
233
253
 
261
281
        branch and discards it, and that's somewhat expensive.)
262
282
        """
263
283
        try:
264
 
            self.open_branch(name)
 
284
            self.open_branch(name, ignore_fallbacks=True)
265
285
            return True
266
286
        except errors.NotBranchError:
267
287
            return False
268
288
 
 
289
    def _get_selected_branch(self):
 
290
        """Return the name of the branch selected by the user.
 
291
 
 
292
        :return: Name of the branch selected by the user, or None.
 
293
        """
 
294
        branch = self.root_transport.get_segment_parameters().get("branch")
 
295
        if branch is not None:
 
296
            branch = urlutils.unescape(branch)
 
297
        return branch
 
298
 
269
299
    def has_workingtree(self):
270
300
        """Tell if this controldir contains a working tree.
271
301
 
298
328
        raise NotImplementedError(self.cloning_metadir)
299
329
 
300
330
    def checkout_metadir(self):
301
 
        """Produce a metadir suitable for checkouts of this controldir."""
 
331
        """Produce a metadir suitable for checkouts of this controldir.
 
332
 
 
333
        :returns: A ControlDirFormat with all component formats
 
334
            either set appropriately or set to None if that component
 
335
            should not be created.
 
336
        """
302
337
        return self.cloning_metadir()
303
338
 
304
339
    def sprout(self, url, revision_id=None, force_new_repo=False,
395
430
        return push_result
396
431
 
397
432
    def _get_tree_branch(self, name=None):
398
 
        """Return the branch and tree, if any, for this bzrdir.
 
433
        """Return the branch and tree, if any, for this controldir.
399
434
 
400
435
        :param name: Name of colocated branch to open.
401
436
 
420
455
        raise NotImplementedError(self.get_config)
421
456
 
422
457
    def check_conversion_target(self, target_format):
423
 
        """Check that a bzrdir as a whole can be converted to a new format."""
 
458
        """Check that a controldir as a whole can be converted to a new format."""
424
459
        raise NotImplementedError(self.check_conversion_target)
425
460
 
426
461
    def clone(self, url, revision_id=None, force_new_repo=False,
427
462
              preserve_stacking=False):
428
 
        """Clone this bzrdir and its contents to url verbatim.
 
463
        """Clone this controldir and its contents to url verbatim.
429
464
 
430
465
        :param url: The url create the clone at.  If url's last component does
431
466
            not exist, it will be created.
445
480
    def clone_on_transport(self, transport, revision_id=None,
446
481
        force_new_repo=False, preserve_stacking=False, stacked_on=None,
447
482
        create_prefix=False, use_existing_dir=True, no_tree=False):
448
 
        """Clone this bzrdir and its contents to transport verbatim.
 
483
        """Clone this controldir and its contents to transport verbatim.
449
484
 
450
485
        :param transport: The transport for the location to produce the clone
451
486
            at.  If the target directory does not exist, it will be created.
463
498
        """
464
499
        raise NotImplementedError(self.clone_on_transport)
465
500
 
 
501
    @classmethod
 
502
    def find_bzrdirs(klass, transport, evaluate=None, list_current=None):
 
503
        """Find control dirs recursively from current location.
 
504
 
 
505
        This is intended primarily as a building block for more sophisticated
 
506
        functionality, like finding trees under a directory, or finding
 
507
        branches that use a given repository.
 
508
 
 
509
        :param evaluate: An optional callable that yields recurse, value,
 
510
            where recurse controls whether this controldir is recursed into
 
511
            and value is the value to yield.  By default, all bzrdirs
 
512
            are recursed into, and the return value is the controldir.
 
513
        :param list_current: if supplied, use this function to list the current
 
514
            directory, instead of Transport.list_dir
 
515
        :return: a generator of found bzrdirs, or whatever evaluate returns.
 
516
        """
 
517
        if list_current is None:
 
518
            def list_current(transport):
 
519
                return transport.list_dir('')
 
520
        if evaluate is None:
 
521
            def evaluate(controldir):
 
522
                return True, controldir
 
523
 
 
524
        pending = [transport]
 
525
        while len(pending) > 0:
 
526
            current_transport = pending.pop()
 
527
            recurse = True
 
528
            try:
 
529
                controldir = klass.open_from_transport(current_transport)
 
530
            except (errors.NotBranchError, errors.PermissionDenied):
 
531
                pass
 
532
            else:
 
533
                recurse, value = evaluate(controldir)
 
534
                yield value
 
535
            try:
 
536
                subdirs = list_current(current_transport)
 
537
            except (errors.NoSuchFile, errors.PermissionDenied):
 
538
                continue
 
539
            if recurse:
 
540
                for subdir in sorted(subdirs, reverse=True):
 
541
                    pending.append(current_transport.clone(subdir))
 
542
 
 
543
    @classmethod
 
544
    def find_branches(klass, transport):
 
545
        """Find all branches under a transport.
 
546
 
 
547
        This will find all branches below the transport, including branches
 
548
        inside other branches.  Where possible, it will use
 
549
        Repository.find_branches.
 
550
 
 
551
        To list all the branches that use a particular Repository, see
 
552
        Repository.find_branches
 
553
        """
 
554
        def evaluate(controldir):
 
555
            try:
 
556
                repository = controldir.open_repository()
 
557
            except errors.NoRepositoryPresent:
 
558
                pass
 
559
            else:
 
560
                return False, ([], repository)
 
561
            return True, (controldir.list_branches(), None)
 
562
        ret = []
 
563
        for branches, repo in klass.find_bzrdirs(
 
564
                transport, evaluate=evaluate):
 
565
            if repo is not None:
 
566
                ret.extend(repo.find_branches())
 
567
            if branches is not None:
 
568
                ret.extend(branches)
 
569
        return ret
 
570
 
 
571
    @classmethod
 
572
    def create_branch_and_repo(klass, base, force_new_repo=False, format=None):
 
573
        """Create a new ControlDir, Branch and Repository at the url 'base'.
 
574
 
 
575
        This will use the current default ControlDirFormat unless one is
 
576
        specified, and use whatever
 
577
        repository format that that uses via controldir.create_branch and
 
578
        create_repository. If a shared repository is available that is used
 
579
        preferentially.
 
580
 
 
581
        The created Branch object is returned.
 
582
 
 
583
        :param base: The URL to create the branch at.
 
584
        :param force_new_repo: If True a new repository is always created.
 
585
        :param format: If supplied, the format of branch to create.  If not
 
586
            supplied, the default is used.
 
587
        """
 
588
        controldir = klass.create(base, format)
 
589
        controldir._find_or_create_repository(force_new_repo)
 
590
        return controldir.create_branch()
 
591
 
 
592
    @classmethod
 
593
    def create_branch_convenience(klass, base, force_new_repo=False,
 
594
                                  force_new_tree=None, format=None,
 
595
                                  possible_transports=None):
 
596
        """Create a new ControlDir, Branch and Repository at the url 'base'.
 
597
 
 
598
        This is a convenience function - it will use an existing repository
 
599
        if possible, can be told explicitly whether to create a working tree or
 
600
        not.
 
601
 
 
602
        This will use the current default ControlDirFormat unless one is
 
603
        specified, and use whatever
 
604
        repository format that that uses via ControlDir.create_branch and
 
605
        create_repository. If a shared repository is available that is used
 
606
        preferentially. Whatever repository is used, its tree creation policy
 
607
        is followed.
 
608
 
 
609
        The created Branch object is returned.
 
610
        If a working tree cannot be made due to base not being a file:// url,
 
611
        no error is raised unless force_new_tree is True, in which case no
 
612
        data is created on disk and NotLocalUrl is raised.
 
613
 
 
614
        :param base: The URL to create the branch at.
 
615
        :param force_new_repo: If True a new repository is always created.
 
616
        :param force_new_tree: If True or False force creation of a tree or
 
617
                               prevent such creation respectively.
 
618
        :param format: Override for the controldir format to create.
 
619
        :param possible_transports: An optional reusable transports list.
 
620
        """
 
621
        if force_new_tree:
 
622
            # check for non local urls
 
623
            t = _mod_transport.get_transport(base, possible_transports)
 
624
            if not isinstance(t, local.LocalTransport):
 
625
                raise errors.NotLocalUrl(base)
 
626
        controldir = klass.create(base, format, possible_transports)
 
627
        repo = controldir._find_or_create_repository(force_new_repo)
 
628
        result = controldir.create_branch()
 
629
        if force_new_tree or (repo.make_working_trees() and
 
630
                              force_new_tree is None):
 
631
            try:
 
632
                controldir.create_workingtree()
 
633
            except errors.NotLocalUrl:
 
634
                pass
 
635
        return result
 
636
 
 
637
    @classmethod
 
638
    def create_standalone_workingtree(klass, base, format=None):
 
639
        """Create a new ControlDir, WorkingTree, Branch and Repository at 'base'.
 
640
 
 
641
        'base' must be a local path or a file:// url.
 
642
 
 
643
        This will use the current default ControlDirFormat unless one is
 
644
        specified, and use whatever
 
645
        repository format that that uses for bzrdirformat.create_workingtree,
 
646
        create_branch and create_repository.
 
647
 
 
648
        :param format: Override for the controldir format to create.
 
649
        :return: The WorkingTree object.
 
650
        """
 
651
        t = _mod_transport.get_transport(base)
 
652
        if not isinstance(t, local.LocalTransport):
 
653
            raise errors.NotLocalUrl(base)
 
654
        controldir = klass.create_branch_and_repo(base,
 
655
                                               force_new_repo=True,
 
656
                                               format=format).bzrdir
 
657
        return controldir.create_workingtree()
 
658
 
 
659
    @classmethod
 
660
    def open_unsupported(klass, base):
 
661
        """Open a branch which is not supported."""
 
662
        return klass.open(base, _unsupported=True)
 
663
 
 
664
    @classmethod
 
665
    def open(klass, base, _unsupported=False, possible_transports=None):
 
666
        """Open an existing controldir, rooted at 'base' (url).
 
667
 
 
668
        :param _unsupported: a private parameter to the ControlDir class.
 
669
        """
 
670
        t = _mod_transport.get_transport(base, possible_transports)
 
671
        return klass.open_from_transport(t, _unsupported=_unsupported)
 
672
 
 
673
    @classmethod
 
674
    def open_from_transport(klass, transport, _unsupported=False,
 
675
                            _server_formats=True):
 
676
        """Open a controldir within a particular directory.
 
677
 
 
678
        :param transport: Transport containing the controldir.
 
679
        :param _unsupported: private.
 
680
        """
 
681
        for hook in klass.hooks['pre_open']:
 
682
            hook(transport)
 
683
        # Keep initial base since 'transport' may be modified while following
 
684
        # the redirections.
 
685
        base = transport.base
 
686
        def find_format(transport):
 
687
            return transport, ControlDirFormat.find_format(
 
688
                transport, _server_formats=_server_formats)
 
689
 
 
690
        def redirected(transport, e, redirection_notice):
 
691
            redirected_transport = transport._redirected_to(e.source, e.target)
 
692
            if redirected_transport is None:
 
693
                raise errors.NotBranchError(base)
 
694
            trace.note(gettext('{0} is{1} redirected to {2}').format(
 
695
                 transport.base, e.permanently, redirected_transport.base))
 
696
            return redirected_transport
 
697
 
 
698
        try:
 
699
            transport, format = _mod_transport.do_catching_redirections(
 
700
                find_format, transport, redirected)
 
701
        except errors.TooManyRedirections:
 
702
            raise errors.NotBranchError(base)
 
703
 
 
704
        format.check_support_status(_unsupported)
 
705
        return format.open(transport, _found=True)
 
706
 
 
707
    @classmethod
 
708
    def open_containing(klass, url, possible_transports=None):
 
709
        """Open an existing branch which contains url.
 
710
 
 
711
        :param url: url to search from.
 
712
 
 
713
        See open_containing_from_transport for more detail.
 
714
        """
 
715
        transport = _mod_transport.get_transport(url, possible_transports)
 
716
        return klass.open_containing_from_transport(transport)
 
717
 
 
718
    @classmethod
 
719
    def open_containing_from_transport(klass, a_transport):
 
720
        """Open an existing branch which contains a_transport.base.
 
721
 
 
722
        This probes for a branch at a_transport, and searches upwards from there.
 
723
 
 
724
        Basically we keep looking up until we find the control directory or
 
725
        run into the root.  If there isn't one, raises NotBranchError.
 
726
        If there is one and it is either an unrecognised format or an unsupported
 
727
        format, UnknownFormatError or UnsupportedFormatError are raised.
 
728
        If there is one, it is returned, along with the unused portion of url.
 
729
 
 
730
        :return: The ControlDir that contains the path, and a Unicode path
 
731
                for the rest of the URL.
 
732
        """
 
733
        # this gets the normalised url back. I.e. '.' -> the full path.
 
734
        url = a_transport.base
 
735
        while True:
 
736
            try:
 
737
                result = klass.open_from_transport(a_transport)
 
738
                return result, urlutils.unescape(a_transport.relpath(url))
 
739
            except errors.NotBranchError, e:
 
740
                pass
 
741
            try:
 
742
                new_t = a_transport.clone('..')
 
743
            except errors.InvalidURLJoin:
 
744
                # reached the root, whatever that may be
 
745
                raise errors.NotBranchError(path=url)
 
746
            if new_t.base == a_transport.base:
 
747
                # reached the root, whatever that may be
 
748
                raise errors.NotBranchError(path=url)
 
749
            a_transport = new_t
 
750
 
 
751
    @classmethod
 
752
    def open_tree_or_branch(klass, location):
 
753
        """Return the branch and working tree at a location.
 
754
 
 
755
        If there is no tree at the location, tree will be None.
 
756
        If there is no branch at the location, an exception will be
 
757
        raised
 
758
        :return: (tree, branch)
 
759
        """
 
760
        controldir = klass.open(location)
 
761
        return controldir._get_tree_branch()
 
762
 
 
763
    @classmethod
 
764
    def open_containing_tree_or_branch(klass, location):
 
765
        """Return the branch and working tree contained by a location.
 
766
 
 
767
        Returns (tree, branch, relpath).
 
768
        If there is no tree at containing the location, tree will be None.
 
769
        If there is no branch containing the location, an exception will be
 
770
        raised
 
771
        relpath is the portion of the path that is contained by the branch.
 
772
        """
 
773
        controldir, relpath = klass.open_containing(location)
 
774
        tree, branch = controldir._get_tree_branch()
 
775
        return tree, branch, relpath
 
776
 
 
777
    @classmethod
 
778
    def open_containing_tree_branch_or_repository(klass, location):
 
779
        """Return the working tree, branch and repo contained by a location.
 
780
 
 
781
        Returns (tree, branch, repository, relpath).
 
782
        If there is no tree containing the location, tree will be None.
 
783
        If there is no branch containing the location, branch will be None.
 
784
        If there is no repository containing the location, repository will be
 
785
        None.
 
786
        relpath is the portion of the path that is contained by the innermost
 
787
        ControlDir.
 
788
 
 
789
        If no tree, branch or repository is found, a NotBranchError is raised.
 
790
        """
 
791
        controldir, relpath = klass.open_containing(location)
 
792
        try:
 
793
            tree, branch = controldir._get_tree_branch()
 
794
        except errors.NotBranchError:
 
795
            try:
 
796
                repo = controldir.find_repository()
 
797
                return None, None, repo, relpath
 
798
            except (errors.NoRepositoryPresent):
 
799
                raise errors.NotBranchError(location)
 
800
        return tree, branch, branch.repository, relpath
 
801
 
 
802
    @classmethod
 
803
    def create(klass, base, format=None, possible_transports=None):
 
804
        """Create a new ControlDir at the url 'base'.
 
805
 
 
806
        :param format: If supplied, the format of branch to create.  If not
 
807
            supplied, the default is used.
 
808
        :param possible_transports: If supplied, a list of transports that
 
809
            can be reused to share a remote connection.
 
810
        """
 
811
        if klass is not ControlDir:
 
812
            raise AssertionError("ControlDir.create always creates the"
 
813
                "default format, not one of %r" % klass)
 
814
        t = _mod_transport.get_transport(base, possible_transports)
 
815
        t.ensure_base()
 
816
        if format is None:
 
817
            format = ControlDirFormat.get_default_format()
 
818
        return format.initialize_on_transport(t)
 
819
 
 
820
 
 
821
class ControlDirHooks(hooks.Hooks):
 
822
    """Hooks for ControlDir operations."""
 
823
 
 
824
    def __init__(self):
 
825
        """Create the default hooks."""
 
826
        hooks.Hooks.__init__(self, "bzrlib.controldir", "ControlDir.hooks")
 
827
        self.add_hook('pre_open',
 
828
            "Invoked before attempting to open a ControlDir with the transport "
 
829
            "that the open will use.", (1, 14))
 
830
        self.add_hook('post_repo_init',
 
831
            "Invoked after a repository has been initialized. "
 
832
            "post_repo_init is called with a "
 
833
            "bzrlib.controldir.RepoInitHookParams.",
 
834
            (2, 2))
 
835
 
 
836
# install the default hooks
 
837
ControlDir.hooks = ControlDirHooks()
 
838
 
466
839
 
467
840
class ControlComponentFormat(object):
468
841
    """A component that can live inside of a .bzr meta directory."""
469
842
 
470
843
    upgrade_recommended = False
471
844
 
472
 
    def get_format_string(self):
473
 
        """Return the format of this format, if usable in meta directories."""
474
 
        raise NotImplementedError(self.get_format_string)
475
 
 
476
845
    def get_format_description(self):
477
846
        """Return the short description for this format."""
478
847
        raise NotImplementedError(self.get_format_description)
505
874
            ui.ui_factory.recommend_upgrade(
506
875
                self.get_format_description(), basedir)
507
876
 
 
877
    @classmethod
 
878
    def get_format_string(cls):
 
879
        raise NotImplementedError(cls.get_format_string)
 
880
 
508
881
 
509
882
class ControlComponentFormatRegistry(registry.FormatRegistry):
510
883
    """A registry for control components (branch, workingtree, repository)."""
661
1034
    def is_supported(self):
662
1035
        """Is this format supported?
663
1036
 
664
 
        Supported formats must be initializable and openable.
 
1037
        Supported formats must be openable.
665
1038
        Unsupported formats may not support initialization or committing or
666
1039
        some other features depending on the reason for not being supported.
667
1040
        """
668
1041
        return True
669
1042
 
 
1043
    def is_initializable(self):
 
1044
        """Whether new control directories of this format can be initialized.
 
1045
        """
 
1046
        return self.is_supported()
 
1047
 
670
1048
    def check_support_status(self, allow_unsupported, recommend_upgrade=True,
671
1049
        basedir=None):
672
1050
        """Give an error or warning on old formats.
828
1206
        """Return the current default format."""
829
1207
        return klass._default_format
830
1208
 
 
1209
    def supports_transport(self, transport):
 
1210
        """Check if this format can be opened over a particular transport.
 
1211
        """
 
1212
        raise NotImplementedError(self.supports_transport)
 
1213
 
831
1214
 
832
1215
class Prober(object):
833
1216
    """Abstract class that can be used to detect a particular kind of
856
1239
        raise NotImplementedError(self.probe_transport)
857
1240
 
858
1241
    @classmethod
859
 
    def known_formats(cls):
 
1242
    def known_formats(klass):
860
1243
        """Return the control dir formats known by this prober.
861
1244
 
862
1245
        Multiple probers can return the same formats, so this should
864
1247
 
865
1248
        :return: A set of known formats.
866
1249
        """
867
 
        raise NotImplementedError(cls.known_formats)
 
1250
        raise NotImplementedError(klass.known_formats)
868
1251
 
869
1252
 
870
1253
class ControlDirFormatInfo(object):
1003
1386
            return output
1004
1387
 
1005
1388
 
 
1389
class RepoInitHookParams(object):
 
1390
    """Object holding parameters passed to `*_repo_init` hooks.
 
1391
 
 
1392
    There are 4 fields that hooks may wish to access:
 
1393
 
 
1394
    :ivar repository: Repository created
 
1395
    :ivar format: Repository format
 
1396
    :ivar bzrdir: The controldir for the repository
 
1397
    :ivar shared: The repository is shared
 
1398
    """
 
1399
 
 
1400
    def __init__(self, repository, format, controldir, shared):
 
1401
        """Create a group of RepoInitHook parameters.
 
1402
 
 
1403
        :param repository: Repository created
 
1404
        :param format: Repository format
 
1405
        :param controldir: The controldir for the repository
 
1406
        :param shared: The repository is shared
 
1407
        """
 
1408
        self.repository = repository
 
1409
        self.format = format
 
1410
        self.bzrdir = controldir
 
1411
        self.shared = shared
 
1412
 
 
1413
    def __eq__(self, other):
 
1414
        return self.__dict__ == other.__dict__
 
1415
 
 
1416
    def __repr__(self):
 
1417
        if self.repository:
 
1418
            return "<%s for %s>" % (self.__class__.__name__,
 
1419
                self.repository)
 
1420
        else:
 
1421
            return "<%s for %s>" % (self.__class__.__name__,
 
1422
                self.bzrdir)
 
1423
 
 
1424
 
1006
1425
# Please register new formats after old formats so that formats
1007
1426
# appear in chronological order and format descriptions can build
1008
1427
# on previous ones.