~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-01 07:56:03 UTC
  • mfrom: (3224.5.40 faster-startup)
  • Revision ID: pqm@pqm.ubuntu.com-20081001075603-s9nynw8y85fmrprj
Reduce startup time by a small amount. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""builtin bzr commands"""
18
18
 
19
19
import os
20
 
from StringIO import StringIO
21
20
 
22
21
from bzrlib.lazy_import import lazy_import
23
22
lazy_import(globals(), """
24
23
import codecs
 
24
import cStringIO
25
25
import sys
26
26
import time
27
27
 
34
34
    config,
35
35
    errors,
36
36
    globbing,
37
 
    ignores,
38
37
    log,
39
38
    merge as _mod_merge,
40
39
    merge_directive,
56
55
 
57
56
from bzrlib.commands import Command, display_command
58
57
from bzrlib.option import ListOption, Option, RegistryOption, custom_help
59
 
from bzrlib.trace import mutter, note, warning, is_quiet, info
 
58
from bzrlib.trace import mutter, note, warning, is_quiet
60
59
 
61
60
 
62
61
def tree_files(file_list, default_branch=u'.'):
1304
1303
         RegistryOption('format',
1305
1304
                help='Specify a format for this branch. '
1306
1305
                'See "help formats".',
1307
 
                registry=bzrdir.format_registry,
1308
 
                converter=bzrdir.format_registry.make_bzrdir,
 
1306
                lazy_registry=('bzrlib.bzrdir', 'format_registry'),
 
1307
                converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
1309
1308
                value_switches=True,
1310
1309
                title="Branch Format",
1311
1310
                ),
1393
1392
    takes_options = [RegistryOption('format',
1394
1393
                            help='Specify a format for this repository. See'
1395
1394
                                 ' "bzr help formats" for details.',
1396
 
                            registry=bzrdir.format_registry,
1397
 
                            converter=bzrdir.format_registry.make_bzrdir,
 
1395
                            lazy_registry=('bzrlib.bzrdir', 'format_registry'),
 
1396
                            converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
1398
1397
                            value_switches=True, title='Repository format'),
1399
1398
                     Option('no-trees',
1400
1399
                             help='Branches in the repository will default to'
2328
2327
            if my_message is None and not file:
2329
2328
                t = make_commit_message_template_encoded(tree,
2330
2329
                        selected_list, diff=show_diff,
2331
 
                        output_encoding=bzrlib.user_encoding)
 
2330
                        output_encoding=osutils.get_user_encoding())
2332
2331
                my_message = edit_commit_message_encoded(t)
2333
2332
                if my_message is None:
2334
2333
                    raise errors.BzrCommandError("please specify a commit"
2338
2337
                    "please specify either --message or --file")
2339
2338
            if file:
2340
2339
                my_message = codecs.open(file, 'rt',
2341
 
                                         bzrlib.user_encoding).read()
 
2340
                                         osutils.get_user_encoding()).read()
2342
2341
            if my_message == "":
2343
2342
                raise errors.BzrCommandError("empty commit message specified")
2344
2343
            return my_message
2444
2443
                    RegistryOption('format',
2445
2444
                        help='Upgrade to a specific format.  See "bzr help'
2446
2445
                             ' formats" for details.',
2447
 
                        registry=bzrdir.format_registry,
2448
 
                        converter=bzrdir.format_registry.make_bzrdir,
 
2446
                        lazy_registry=('bzrlib.bzrdir', 'format_registry'),
 
2447
                        converter=lambda name: bzrdir.format_registry.make_bzrdir(name),
2449
2448
                        value_switches=True, title='Branch format'),
2450
2449
                    ]
2451
2450
 
2708
2707
            first=False, list_only=False,
2709
2708
            randomize=None, exclude=None, strict=False,
2710
2709
            load_list=None, debugflag=None, starting_with=None):
2711
 
        import bzrlib.ui
2712
2710
        from bzrlib.tests import selftest
2713
2711
        import bzrlib.benchmarks as benchmarks
2714
2712
        from bzrlib.benchmarks import tree_creator
4209
4207
        from bzrlib.revision import NULL_REVISION
4210
4208
        branch = Branch.open_containing(from_)[0]
4211
4209
        if output is None:
4212
 
            outfile = StringIO()
 
4210
            outfile = cStringIO.StringIO()
4213
4211
        elif output == '-':
4214
4212
            outfile = self.outf
4215
4213
        else: