~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-23 08:51:52 UTC
  • mfrom: (5131.2.6 support_OO_flag)
  • mto: This revision was merged to the branch mainline in revision 5179.
  • Revision ID: v.ladeuil+lp@free.fr-20100423085152-uoewc1vnkwqhw0pj
Manually assign docstrings to command objects, so that they work with python -OO

Show diffs side-by-side

added added

removed removed

Lines of Context:
504
504
                if (working.has_changes()):
505
505
                    raise errors.UncommittedChanges(working)
506
506
 
507
 
            if working.user_url != working.branch.user_url:
 
507
            working_path = working.bzrdir.root_transport.base
 
508
            branch_path = working.branch.bzrdir.root_transport.base
 
509
            if working_path != branch_path:
508
510
                raise errors.BzrCommandError("You cannot remove the working tree"
509
511
                                             " from a lightweight checkout")
510
512
 
1132
1134
        else:
1133
1135
            revision_id = None
1134
1136
        if tree is not None and revision_id is None:
1135
 
            tree.check_changed_or_out_of_date(
1136
 
                strict, 'push_strict',
1137
 
                more_error='Use --no-strict to force the push.',
1138
 
                more_warning='Uncommitted changes will not be pushed.')
 
1137
            tree.warn_if_changed_or_out_of_date(
 
1138
                strict, 'push_strict', 'Use --no-strict to force the push.')
1139
1139
        # Get the stacked_on branch, if any
1140
1140
        if stacked_on is not None:
1141
1141
            stacked_on = urlutils.normalize_url(stacked_on)
2299
2299
                   help='Show changes made in each revision as a patch.'),
2300
2300
            Option('include-merges',
2301
2301
                   help='Show merged revisions like --levels 0 does.'),
2302
 
            Option('exclude-common-ancestry',
2303
 
                   help='Display only the revisions that are not part'
2304
 
                   ' of both ancestries (require -rX..Y)'
2305
 
                   )
2306
2302
            ]
2307
2303
    encoding_type = 'replace'
2308
2304
 
2318
2314
            message=None,
2319
2315
            limit=None,
2320
2316
            show_diff=False,
2321
 
            include_merges=False,
2322
 
            exclude_common_ancestry=False,
2323
 
            ):
 
2317
            include_merges=False):
2324
2318
        from bzrlib.log import (
2325
2319
            Logger,
2326
2320
            make_log_request_dict,
2327
2321
            _get_info_for_log_files,
2328
2322
            )
2329
2323
        direction = (forward and 'forward') or 'reverse'
2330
 
        if (exclude_common_ancestry
2331
 
            and (revision is None or len(revision) != 2)):
2332
 
            raise errors.BzrCommandError(
2333
 
                '--exclude-common-ancestry requires -r with two revisions')
2334
2324
        if include_merges:
2335
2325
            if levels is None:
2336
2326
                levels = 0
2429
2419
            direction=direction, specific_fileids=file_ids,
2430
2420
            start_revision=rev1, end_revision=rev2, limit=limit,
2431
2421
            message_search=message, delta_type=delta_type,
2432
 
            diff_type=diff_type, _match_using_deltas=match_using_deltas,
2433
 
            exclude_common_ancestry=exclude_common_ancestry,
2434
 
            )
 
2422
            diff_type=diff_type, _match_using_deltas=match_using_deltas)
2435
2423
        Logger(b, rqst).show(lf)
2436
2424
 
2437
2425
 
2661
2649
    using this command or directly by using an editor, be sure to commit
2662
2650
    it.
2663
2651
    
2664
 
    Bazaar also supports a global ignore file ~/.bazaar/ignore. On Windows
2665
 
    the global ignore file can be found in the application data directory as
2666
 
    C:\\Documents and Settings\\<user>\\Application Data\\Bazaar\\2.0\\ignore.
2667
 
    Global ignores are not touched by this command. The global ignore file
2668
 
    can be edited directly using an editor.
2669
 
 
2670
2652
    Patterns prefixed with '!' are exceptions to ignore patterns and take
2671
2653
    precedence over regular ignores.  Such exceptions are used to specify
2672
2654
    files that should be versioned which would otherwise be ignored.
2713
2695
    _see_also = ['status', 'ignored', 'patterns']
2714
2696
    takes_args = ['name_pattern*']
2715
2697
    takes_options = [
2716
 
        Option('default-rules',
2717
 
               help='Display the default ignore rules that bzr uses.')
 
2698
        Option('old-default-rules',
 
2699
               help='Write out the ignore rules bzr < 0.9 always used.')
2718
2700
        ]
2719
2701
 
2720
 
    def run(self, name_pattern_list=None, default_rules=None):
 
2702
    def run(self, name_pattern_list=None, old_default_rules=None):
2721
2703
        from bzrlib import ignores
2722
 
        if default_rules is not None:
2723
 
            # dump the default rules and exit
2724
 
            for pattern in ignores.USER_DEFAULTS:
 
2704
        if old_default_rules is not None:
 
2705
            # dump the rules and exit
 
2706
            for pattern in ignores.OLD_DEFAULTS:
2725
2707
                self.outf.write("%s\n" % pattern)
2726
2708
            return
2727
2709
        if not name_pattern_list:
2728
2710
            raise errors.BzrCommandError("ignore requires at least one "
2729
 
                "NAME_PATTERN or --default-rules.")
 
2711
                                  "NAME_PATTERN or --old-default-rules")
2730
2712
        name_pattern_list = [globbing.normalize_pattern(p)
2731
2713
                             for p in name_pattern_list]
2732
2714
        for name_pattern in name_pattern_list:
3073
3055
                         "the master branch until a normal commit "
3074
3056
                         "is performed."
3075
3057
                    ),
3076
 
             Option('show-diff', short_name='p',
 
3058
             Option('show-diff',
3077
3059
                    help='When no message is supplied, show the diff along'
3078
3060
                    ' with the status summary in the message editor.'),
3079
3061
             ]
4681
4663
 
4682
4664
class cmd_bind(Command):
4683
4665
    __doc__ = """Convert the current branch into a checkout of the supplied branch.
4684
 
    If no branch is supplied, rebind to the last bound location.
4685
4666
 
4686
4667
    Once converted into a checkout, commits must succeed on the master branch
4687
4668
    before they will be applied to the local branch.