~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Benoît Pierre
  • Date: 2011-10-10 20:55:52 UTC
  • mto: This revision was merged to the branch mainline in revision 6215.
  • Revision ID: benoit.pierre@gmail.com-20111010205552-7o6qoaiihy31hhxb
Avoid prompt duplication for shelf_ui tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    do_catching_redirections,
56
56
    local,
57
57
    )
 
58
from bzrlib.i18n import gettext
58
59
""")
59
60
 
60
61
from bzrlib.trace import (
543
544
                    stacked=stacked)
544
545
        return result
545
546
 
546
 
 
547
 
 
548
547
    @staticmethod
549
548
    def create_branch_convenience(base, force_new_repo=False,
550
549
                                  force_new_tree=None, format=None,
634
633
            old_path = self.root_transport.abspath('.bzr')
635
634
            backup_dir = self._available_backup_name('backup.bzr')
636
635
            new_path = self.root_transport.abspath(backup_dir)
637
 
            ui.ui_factory.note('making backup of %s\n  to %s'
638
 
                               % (old_path, new_path,))
 
636
            ui.ui_factory.note(gettext('making backup of {0}\n  to {1}').format(
 
637
                urlutils.unescape_for_display(old_path, 'utf-8'),
 
638
                urlutils.unescape_for_display(new_path, 'utf-8')))
639
639
            self.root_transport.copy_tree('.bzr', backup_dir)
640
640
            return (old_path, new_path)
641
641
        finally:
656
656
            try:
657
657
                to_path = '.bzr.retired.%d' % i
658
658
                self.root_transport.rename('.bzr', to_path)
659
 
                note("renamed %s to %s"
660
 
                    % (self.root_transport.abspath('.bzr'), to_path))
 
659
                note(gettext("renamed {0} to {1}").format(
 
660
                    self.root_transport.abspath('.bzr'), to_path))
661
661
                return
662
662
            except (errors.TransportError, IOError, errors.PathError):
663
663
                i += 1
848
848
            redirected_transport = transport._redirected_to(e.source, e.target)
849
849
            if redirected_transport is None:
850
850
                raise errors.NotBranchError(base)
851
 
            note('%s is%s redirected to %s',
852
 
                 transport.base, e.permanently, redirected_transport.base)
 
851
            note(gettext('{0} is{1} redirected to {2}').format(
 
852
                 transport.base, e.permanently, redirected_transport.base))
853
853
            return redirected_transport
854
854
 
855
855
        try:
1146
1146
        """See BzrDir.can_convert_format()."""
1147
1147
        return True
1148
1148
 
1149
 
    def create_branch(self, name=None, repository=None):
 
1149
    def create_branch(self, name=None, repository=None,
 
1150
            append_revisions_only=None):
1150
1151
        """See BzrDir.create_branch."""
1151
1152
        return self._format.get_branch_format().initialize(self, name=name,
1152
 
                repository=repository)
 
1153
                repository=repository,
 
1154
                append_revisions_only=append_revisions_only)
1153
1155
 
1154
1156
    def destroy_branch(self, name=None):
1155
1157
        """See BzrDir.create_branch."""
1722
1724
                    new_repo_format = None
1723
1725
            if new_repo_format is not None:
1724
1726
                self.repository_format = new_repo_format
1725
 
                note('Source repository format does not support stacking,'
1726
 
                     ' using format:\n  %s',
 
1727
                note(gettext('Source repository format does not support stacking,'
 
1728
                     ' using format:\n  %s'),
1727
1729
                     new_repo_format.get_format_description())
1728
1730
 
1729
1731
        if not self.get_branch_format().supports_stacking():
1742
1744
            if new_branch_format is not None:
1743
1745
                # Does support stacking, use its format.
1744
1746
                self.set_branch_format(new_branch_format)
1745
 
                note('Source branch format does not support stacking,'
1746
 
                     ' using format:\n  %s',
 
1747
                note(gettext('Source branch format does not support stacking,'
 
1748
                     ' using format:\n  %s'),
1747
1749
                     new_branch_format.get_format_description())
1748
1750
 
1749
1751
    def get_converter(self, format=None):
1853
1855
        else:
1854
1856
            if not isinstance(repo._format, self.target_format.repository_format.__class__):
1855
1857
                from bzrlib.repository import CopyConverter
1856
 
                ui.ui_factory.note('starting repository conversion')
 
1858
                ui.ui_factory.note(gettext('starting repository conversion'))
1857
1859
                converter = CopyConverter(self.target_format.repository_format)
1858
1860
                converter.convert(repo, pb)
1859
1861
        for branch in self.bzrdir.list_branches():
2032
2034
                                    possible_transports=[self._bzrdir.root_transport])
2033
2035
            if not self._require_stacking:
2034
2036
                # We have picked up automatic stacking somewhere.
2035
 
                note('Using default stacking branch %s at %s', self._stack_on,
2036
 
                    self._stack_on_pwd)
 
2037
                note(gettext('Using default stacking branch {0} at {1}').format(
 
2038
                    self._stack_on, self._stack_on_pwd))
2037
2039
        repository = self._bzrdir.create_repository(shared=shared)
2038
2040
        self._add_fallback(repository,
2039
2041
                           possible_transports=[self._bzrdir.transport])
2287
2289
    help='Same as 2a.')
2288
2290
 
2289
2291
# The current format that is made on 'bzr init'.
2290
 
format_name = config.GlobalConfig().get_user_option('default_format')
2291
 
if format_name is None:
2292
 
    controldir.format_registry.set_default('2a')
2293
 
else:
2294
 
    controldir.format_registry.set_default(format_name)
 
2292
format_name = config.GlobalStack().get('default_format')
 
2293
controldir.format_registry.set_default(format_name)
2295
2294
 
2296
2295
# XXX 2010-08-20 JRV: There is still a lot of code relying on
2297
2296
# bzrlib.bzrdir.format_registry existing. When BzrDir.create/BzrDir.open/etc