~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-17 22:24:01 UTC
  • mfrom: (5379 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5389.
  • Revision ID: jelmer@samba.org-20100817222401-x6iblsx36pu6bi3r
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib.lazy_import import lazy_import
22
22
lazy_import(globals(), """
23
 
import codecs
24
23
import cStringIO
25
24
import sys
26
25
import time
1593
1592
 
1594
1593
    _see_also = ['check']
1595
1594
    takes_args = ['branch?']
 
1595
    takes_options = [
 
1596
        Option('canonicalize-chks',
 
1597
               help='Make sure CHKs are in canonical form (repairs '
 
1598
                    'bug 522637).',
 
1599
               hidden=True),
 
1600
        ]
1596
1601
 
1597
 
    def run(self, branch="."):
 
1602
    def run(self, branch=".", canonicalize_chks=False):
1598
1603
        from bzrlib.reconcile import reconcile
1599
1604
        dir = bzrdir.BzrDir.open(branch)
1600
 
        reconcile(dir)
 
1605
        reconcile(dir, canonicalize_chks=canonicalize_chks)
1601
1606
 
1602
1607
 
1603
1608
class cmd_revision_history(Command):
2689
2694
                "NAME_PATTERN or --default-rules.")
2690
2695
        name_pattern_list = [globbing.normalize_pattern(p)
2691
2696
                             for p in name_pattern_list]
 
2697
        bad_patterns = ''
 
2698
        for p in name_pattern_list:
 
2699
            if not globbing.Globster.is_pattern_valid(p):
 
2700
                bad_patterns += ('\n  %s' % p)
 
2701
        if bad_patterns:
 
2702
            msg = ('Invalid ignore pattern(s) found. %s' % bad_patterns)
 
2703
            ui.ui_factory.show_error(msg)
 
2704
            raise errors.InvalidPattern('')
2692
2705
        for name_pattern in name_pattern_list:
2693
2706
            if (name_pattern[0] == '/' or
2694
2707
                (len(name_pattern) > 1 and name_pattern[1] == ':')):
3127
3140
        def get_message(commit_obj):
3128
3141
            """Callback to get commit message"""
3129
3142
            if file:
3130
 
                f = codecs.open(file, 'rt', osutils.get_user_encoding())
 
3143
                f = open(file)
3131
3144
                try:
3132
 
                    my_message = f.read()
 
3145
                    my_message = f.read().decode(osutils.get_user_encoding())
3133
3146
                finally:
3134
3147
                    f.close()
3135
3148
            elif message is not None:
3506
3519
                                 'throughout the test suite.',
3507
3520
                            type=get_transport_type),
3508
3521
                     Option('benchmark',
3509
 
                            help='Run the benchmarks rather than selftests.'),
 
3522
                            help='Run the benchmarks rather than selftests.',
 
3523
                            hidden=True),
3510
3524
                     Option('lsprof-timed',
3511
3525
                            help='Generate lsprof output for benchmarked'
3512
3526
                                 ' sections of code.'),
3513
3527
                     Option('lsprof-tests',
3514
3528
                            help='Generate lsprof output for each test.'),
3515
 
                     Option('cache-dir', type=str,
3516
 
                            help='Cache intermediate benchmark output in this '
3517
 
                                 'directory.'),
3518
3529
                     Option('first',
3519
3530
                            help='Run all tests, but run specified tests first.',
3520
3531
                            short_name='f',
3554
3565
 
3555
3566
    def run(self, testspecs_list=None, verbose=False, one=False,
3556
3567
            transport=None, benchmark=None,
3557
 
            lsprof_timed=None, cache_dir=None,
 
3568
            lsprof_timed=None,
3558
3569
            first=False, list_only=False,
3559
3570
            randomize=None, exclude=None, strict=False,
3560
3571
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3561
3572
            parallel=None, lsprof_tests=False):
3562
3573
        from bzrlib.tests import selftest
3563
 
        import bzrlib.benchmarks as benchmarks
3564
 
        from bzrlib.benchmarks import tree_creator
3565
3574
 
3566
3575
        # Make deprecation warnings visible, unless -Werror is set
3567
3576
        symbol_versioning.activate_deprecation_warnings(override=False)
3568
3577
 
3569
 
        if cache_dir is not None:
3570
 
            tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
3571
3578
        if testspecs_list is not None:
3572
3579
            pattern = '|'.join(testspecs_list)
3573
3580
        else:
3592
3599
            self.additional_selftest_args.setdefault(
3593
3600
                'suite_decorators', []).append(parallel)
3594
3601
        if benchmark:
3595
 
            test_suite_factory = benchmarks.test_suite
3596
 
            # Unless user explicitly asks for quiet, be verbose in benchmarks
3597
 
            verbose = not is_quiet()
3598
 
            # TODO: should possibly lock the history file...
3599
 
            benchfile = open(".perf_history", "at", buffering=1)
3600
 
            self.add_cleanup(benchfile.close)
3601
 
        else:
3602
 
            test_suite_factory = None
3603
 
            benchfile = None
 
3602
            raise errors.BzrCommandError(
 
3603
                "--benchmark is no longer supported from bzr 2.2; "
 
3604
                "use bzr-usertest instead")
 
3605
        test_suite_factory = None
3604
3606
        selftest_kwargs = {"verbose": verbose,
3605
3607
                          "pattern": pattern,
3606
3608
                          "stop_on_failure": one,
3608
3610
                          "test_suite_factory": test_suite_factory,
3609
3611
                          "lsprof_timed": lsprof_timed,
3610
3612
                          "lsprof_tests": lsprof_tests,
3611
 
                          "bench_history": benchfile,
3612
3613
                          "matching_tests_first": first,
3613
3614
                          "list_only": list_only,
3614
3615
                          "random_seed": randomize,