~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Martin Pool
  • Date: 2007-07-10 10:20:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2599.
  • Revision ID: mbp@sourcefrog.net-20070710102027-2os88re33c57m522
Add test for and documentation of option style, fix up existing options to comply

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
    
169
169
    takes_args = ['file*']
170
170
    takes_options = ['show-ids', 'revision',
171
 
                     Option('short', help='Give short SVN-style status lines'),
172
 
                     Option('versioned', help='Only show versioned files')]
 
171
                     Option('short', help='Give short SVN-style status lines.'),
 
172
                     Option('versioned', help='Only show versioned files.')]
173
173
    aliases = ['st', 'stat']
174
174
 
175
175
    encoding_type = 'replace'
340
340
    takes_args = ['file*']
341
341
    takes_options = ['no-recurse', 'dry-run', 'verbose',
342
342
                     Option('file-ids-from', type=unicode,
343
 
                            help='Lookup file ids from here')]
 
343
                            help='Lookup file ids from this tree.')]
344
344
    encoding_type = 'replace'
345
345
    _see_also = ['remove']
346
346
 
506
506
    """
507
507
 
508
508
    takes_args = ['names*']
509
 
    takes_options = [Option("after", help="move only the bzr identifier"
510
 
        " of the file (file has already been moved). Use this flag if"
511
 
        " bzr is not able to detect this itself.")]
 
509
    takes_options = [Option("after", help="Move only the bzr identifier"
 
510
        " of the file, because the file has already been moved."),
 
511
        ]
512
512
    aliases = ['move', 'rename']
513
513
    encoding_type = 'replace'
514
514
 
556
556
    _see_also = ['push', 'update', 'status-flags']
557
557
    takes_options = ['remember', 'overwrite', 'revision', 'verbose',
558
558
        Option('directory',
559
 
            help='branch to pull into, '
560
 
                 'rather than the one containing the working directory',
 
559
            help='Branch to pull into, '
 
560
                 'rather than the one containing the working directory.',
561
561
            short_name='d',
562
562
            type=unicode,
563
563
            ),
664
664
    takes_options = ['remember', 'overwrite', 'verbose',
665
665
        Option('create-prefix',
666
666
               help='Create the path leading up to the branch '
667
 
                    'if it does not already exist'),
 
667
                    'if it does not already exist.'),
668
668
        Option('directory',
669
 
            help='branch to push from, '
670
 
                 'rather than the one containing the working directory',
 
669
            help='Branch to push from, '
 
670
                 'rather than the one containing the working directory.',
671
671
            short_name='d',
672
672
            type=unicode,
673
673
            ),
674
674
        Option('use-existing-dir',
675
675
               help='By default push will fail if the target'
676
676
                    ' directory exists, but does not already'
677
 
                    ' have a control directory. This flag will'
 
677
                    ' have a control directory.  This flag will'
678
678
                    ' allow push to proceed.'),
679
679
        ]
680
680
    takes_args = ['location?']
907
907
    takes_args = ['branch_location?', 'to_location?']
908
908
    takes_options = ['revision',
909
909
                     Option('lightweight',
910
 
                            help="perform a lightweight checkout. Lightweight "
 
910
                            help="Perform a lightweight checkout.  Lightweight "
911
911
                                 "checkouts depend on access to the branch for "
912
 
                                 "every operation. Normal checkouts can perform "
 
912
                                 "every operation.  Normal checkouts can perform "
913
913
                                 "common operations like diff and status without "
914
914
                                 "such access, and also support local commits."
915
915
                            ),
1066
1066
    """
1067
1067
    takes_args = ['file*']
1068
1068
    takes_options = ['verbose',
1069
 
        Option('new', help='remove newly-added files'),
 
1069
        Option('new', help='Remove newly-added files.'),
1070
1070
        RegistryOption.from_kwargs('file-deletion-strategy',
1071
1071
            'The file deletion mode to be used',
1072
1072
            title='Deletion Strategy', value_switches=True, enum_switch=False,
1240
1240
    takes_options = [
1241
1241
        Option('create-prefix',
1242
1242
               help='Create the path leading up to the branch '
1243
 
                    'if it does not already exist'),
 
1243
                    'if it does not already exist.'),
1244
1244
         RegistryOption('format',
1245
1245
                help='Specify a format for this branch. '
1246
1246
                'See "help formats".',
1325
1325
    takes_args = ["location"]
1326
1326
    takes_options = [RegistryOption('format',
1327
1327
                            help='Specify a format for this repository. See'
1328
 
                                 ' "bzr help formats" for details',
 
1328
                                 ' "bzr help formats" for details.',
1329
1329
                            registry=bzrdir.format_registry,
1330
1330
                            converter=bzrdir.format_registry.make_bzrdir,
1331
1331
                            value_switches=True, title='Repository format'),
1332
1332
                     Option('no-trees',
1333
1333
                             help='Branches in the repository will default to'
1334
 
                                  ' not having a working tree'),
 
1334
                                  ' not having a working tree.'),
1335
1335
                    ]
1336
1336
    aliases = ["init-repo"]
1337
1337
 
1390
1390
        Option('prefix', type=str,
1391
1391
               short_name='p',
1392
1392
               help='Set prefixes to added to old and new filenames, as '
1393
 
                    'two values separated by a colon. (eg "old/:new/")'),
 
1393
                    'two values separated by a colon. (eg "old/:new/").'),
1394
1394
        ]
1395
1395
    aliases = ['di', 'dif']
1396
1396
    encoding_type = 'exact'
1581
1581
    # TODO: Make --revision support uuid: and hash: [future tag:] notation.
1582
1582
 
1583
1583
    takes_args = ['location?']
1584
 
    takes_options = [Option('forward', 
1585
 
                            help='show from oldest to newest'),
1586
 
                     'timezone', 
1587
 
                     Option('verbose', 
 
1584
    takes_options = [Option('forward',
 
1585
                            help='Show from oldest to newest.'),
 
1586
                     'timezone',
 
1587
                     Option('verbose',
1588
1588
                             short_name='v',
1589
 
                             help='show files changed in each revision'),
 
1589
                             help='Show files changed in each revision.'),
1590
1590
                     'show-ids', 'revision',
1591
1591
                     'log-format',
1592
1592
                     Option('message',
1593
1593
                            short_name='m',
1594
 
                            help='show revisions whose message matches this regexp',
 
1594
                            help='Show revisions whose message matches this regexp.',
1595
1595
                            type=str),
1596
 
                     Option('limit', 
1597
 
                            help='limit the output to the first N revisions',
 
1596
                     Option('limit',
 
1597
                            help='Limit the output to the first N revisions.',
1598
1598
                            type=_parse_limit),
1599
1599
                     ]
1600
1600
    encoding_type = 'replace'
1717
1717
    # TODO: Take a revision or remote path and list that tree instead.
1718
1718
    takes_options = ['verbose', 'revision',
1719
1719
                     Option('non-recursive',
1720
 
                            help='don\'t recurse into sub-directories'),
 
1720
                            help='Don\'t recurse into subdirectories.'),
1721
1721
                     Option('from-root',
1722
1722
                            help='Print all paths from the root of the branch.'),
1723
1723
                     Option('unknown', help='Print unknown files'),
1724
1724
                     Option('versioned', help='Print versioned files'),
1725
1725
                     Option('ignored', help='Print ignored files'),
1726
 
 
1727
 
                     Option('null', help='Null separate the files'),
1728
 
                     'kind', 'show-ids'
 
1726
                     Option('null',
 
1727
                            help='Write an ascii NUL (\\0) separator '
 
1728
                            'between files rather than a newline.'),
 
1729
                     'kind',
 
1730
                     'show-ids',
1729
1731
                    ]
1730
1732
    @display_command
1731
1733
    def run(self, revision=None, verbose=False, 
1850
1852
    _see_also = ['status', 'ignored']
1851
1853
    takes_args = ['name_pattern*']
1852
1854
    takes_options = [
1853
 
                     Option('old-default-rules',
1854
 
                            help='Out the ignore rules bzr < 0.9 always used.')
1855
 
                     ]
 
1855
        Option('old-default-rules',
 
1856
               help='Write out the ignore rules bzr < 0.9 always used.')
 
1857
        ]
1856
1858
    
1857
1859
    def run(self, name_pattern_list=None, old_default_rules=None):
1858
1860
        from bzrlib.atomicfile import AtomicFile
2094
2096
 
2095
2097
    _see_also = ['bugs', 'uncommit']
2096
2098
    takes_args = ['selected*']
2097
 
    takes_options = ['message', 'verbose', 
2098
 
                     Option('unchanged',
2099
 
                            help='commit even if nothing has changed'),
2100
 
                     Option('file', type=str, 
2101
 
                            short_name='F',
2102
 
                            argname='msgfile',
2103
 
                            help='file containing commit message'),
2104
 
                     Option('strict',
2105
 
                            help="refuse to commit if there are unknown "
2106
 
                            "files in the working tree."),
2107
 
                     ListOption('fixes', type=str,
2108
 
                                help="mark a bug as being fixed by this "
2109
 
                                     "revision."),
2110
 
                     Option('local',
2111
 
                            help="perform a local only commit in a bound "
2112
 
                                 "branch. Such commits are not pushed to "
2113
 
                                 "the master branch until a normal commit "
2114
 
                                 "is performed."
2115
 
                            ),
2116
 
                     ]
 
2099
    takes_options = [
 
2100
            'message',
 
2101
            'verbose',
 
2102
             Option('unchanged',
 
2103
                    help='Commit even if nothing has changed.'),
 
2104
             Option('file', type=str,
 
2105
                    short_name='F',
 
2106
                    argname='msgfile',
 
2107
                    help='Take commit message from this file.'),
 
2108
             Option('strict',
 
2109
                    help="Refuse to commit if there are unknown "
 
2110
                    "files in the working tree."),
 
2111
             ListOption('fixes', type=str,
 
2112
                    help="Mark a bug as being fixed by this revision."),
 
2113
             Option('local',
 
2114
                    help="Perform a local commit in a bound "
 
2115
                         "branch.  Local commits are not pushed to "
 
2116
                         "the master branch until a normal commit "
 
2117
                         "is performed."
 
2118
                    ),
 
2119
             ]
2117
2120
    aliases = ['ci', 'checkin']
2118
2121
 
2119
2122
    def _get_bug_fix_properties(self, fixes, branch):
2250
2253
    takes_options = [
2251
2254
                    RegistryOption('format',
2252
2255
                        help='Upgrade to a specific format.  See "bzr help'
2253
 
                             ' formats" for details',
 
2256
                             ' formats" for details.',
2254
2257
                        registry=bzrdir.format_registry,
2255
2258
                        converter=bzrdir.format_registry.make_bzrdir,
2256
2259
                        value_switches=True, title='Branch format'),
2271
2274
        bzr whoami 'Frank Chu <fchu@example.com>'
2272
2275
    """
2273
2276
    takes_options = [ Option('email',
2274
 
                             help='display email address only'),
 
2277
                             help='Display email address only.'),
2275
2278
                      Option('branch',
2276
 
                             help='set identity for the current branch instead of '
2277
 
                                  'globally'),
 
2279
                             help='Set identity for the current branch instead of '
 
2280
                                  'globally.'),
2278
2281
                    ]
2279
2282
    takes_args = ['name?']
2280
2283
    encoding_type = 'replace'
2394
2397
    takes_args = ['testspecs*']
2395
2398
    takes_options = ['verbose',
2396
2399
                     Option('one',
2397
 
                             help='stop when one test fails',
 
2400
                             help='Stop when one test fails.',
2398
2401
                             short_name='1',
2399
2402
                             ),
2400
2403
                     Option('keep-output',
2401
 
                            help='keep output directories when tests fail'),
 
2404
                            help='Keep output directories when tests fail.'),
2402
2405
                     Option('transport',
2403
2406
                            help='Use a different transport by default '
2404
2407
                                 'throughout the test suite.',
2405
2408
                            type=get_transport_type),
2406
 
                     Option('benchmark', help='run the bzr benchmarks.'),
 
2409
                     Option('benchmark',
 
2410
                            help='Run the benchmarks rather than selftests.'),
2407
2411
                     Option('lsprof-timed',
2408
 
                            help='generate lsprof output for benchmarked'
 
2412
                            help='Generate lsprof output for benchmarked'
2409
2413
                                 ' sections of code.'),
2410
2414
                     Option('cache-dir', type=str,
2411
 
                            help='a directory to cache intermediate'
2412
 
                                 ' benchmark steps'),
 
2415
                            help='Cache intermediate benchmark output in this '
 
2416
                                 'directory.'),
2413
2417
                     Option('clean-output',
2414
 
                            help='clean temporary tests directories'
2415
 
                                 ' without running tests'),
 
2418
                            help='Clean temporary tests directories'
 
2419
                                 ' without running tests.'),
2416
2420
                     Option('first',
2417
 
                            help='run all tests, but run specified tests first',
 
2421
                            help='Run all tests, but run specified tests first.',
2418
2422
                            short_name='f',
2419
2423
                            ),
2420
2424
                     Option('numbered-dirs',
2421
 
                            help='use numbered dirs for TestCaseInTempDir'),
 
2425
                            help='Use numbered dirs for TestCaseInTempDir.'),
2422
2426
                     Option('list-only',
2423
 
                            help='list the tests instead of running them'),
 
2427
                            help='List the tests instead of running them.'),
2424
2428
                     Option('randomize', type=str, argname="SEED",
2425
 
                            help='randomize the order of tests using the given'
2426
 
                                 ' seed or "now" for the current time'),
 
2429
                            help='Randomize the order of tests using the given'
 
2430
                                 ' seed or "now" for the current time.'),
2427
2431
                     Option('exclude', type=str, argname="PATTERN",
2428
2432
                            short_name='x',
2429
 
                            help='exclude tests that match this regular'
2430
 
                                 ' expression'),
 
2433
                            help='Exclude tests that match this regular'
 
2434
                                 ' expression.'),
2431
2435
                     ]
2432
2436
    encoding_type = 'replace'
2433
2437
 
2587
2591
    takes_args = ['branch?']
2588
2592
    takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2589
2593
        Option('show-base', help="Show base revision text in "
2590
 
               "conflicts"),
 
2594
               "conflicts."),
2591
2595
        Option('uncommitted', help='Apply uncommitted changes'
2592
 
               ' from a working copy, instead of branch changes'),
 
2596
               ' from a working copy, instead of branch changes.'),
2593
2597
        Option('pull', help='If the destination is already'
2594
2598
                ' completely merged into the source, pull from the'
2595
 
                ' source rather than merging. When this happens,'
 
2599
                ' source rather than merging.  When this happens,'
2596
2600
                ' you do not need to commit the result.'),
2597
2601
        Option('directory',
2598
2602
            help='Branch to merge into, '
2599
 
                 'rather than the one containing the working directory',
 
2603
                 'rather than the one containing the working directory.',
2600
2604
            short_name='d',
2601
2605
            type=unicode,
2602
2606
            ),
2761
2765
        additional processing to reduce the size of conflict regions.
2762
2766
    """
2763
2767
    takes_args = ['file*']
2764
 
    takes_options = ['merge-type', 'reprocess',
2765
 
                     Option('show-base', help="Show base revision text in "
2766
 
                            "conflicts")]
 
2768
    takes_options = [
 
2769
            'merge-type',
 
2770
            'reprocess',
 
2771
            Option('show-base',
 
2772
                   help="Show base revision text in conflicts."),
 
2773
            ]
2767
2774
 
2768
2775
    def run(self, file_list=None, merge_type=None, show_base=False,
2769
2776
            reprocess=False):
2893
2900
    """
2894
2901
 
2895
2902
    _see_also = ['topics']
2896
 
    takes_options = [Option('long', 'show help on all commands')]
 
2903
    takes_options = [
 
2904
            Option('long', 'Show help on all commands.'),
 
2905
            ]
2897
2906
    takes_args = ['topic?']
2898
2907
    aliases = ['?', '--help', '-?', '-h']
2899
2908
    
2942
2951
 
2943
2952
    _see_also = ['merge', 'pull']
2944
2953
    takes_args = ['other_branch?']
2945
 
    takes_options = [Option('reverse', 'Reverse the order of revisions'),
2946
 
                     Option('mine-only', 
2947
 
                            'Display changes in the local branch only'),
2948
 
                     Option('this' , 'same as --mine-only'),
2949
 
                     Option('theirs-only', 
2950
 
                            'Display changes in the remote branch only'),
2951
 
                     Option('other', 'same as --theirs-only'),
2952
 
                     'log-format',
2953
 
                     'show-ids',
2954
 
                     'verbose'
2955
 
                     ]
 
2954
    takes_options = [
 
2955
            Option('reverse', 'Reverse the order of revisions.'),
 
2956
            Option('mine-only',
 
2957
                   'Display changes in the local branch only.'),
 
2958
            Option('this' , 'Same as --mine-only.'),
 
2959
            Option('theirs-only',
 
2960
                   'Display changes in the remote branch only.'),
 
2961
            Option('other', 'Same as --theirs-only.'),
 
2962
            'log-format',
 
2963
            'show-ids',
 
2964
            'verbose'
 
2965
            ]
2956
2966
    encoding_type = 'replace'
2957
2967
 
2958
2968
    @display_command
3053
3063
 
3054
3064
class cmd_testament(Command):
3055
3065
    """Show testament (signing-form) of a revision."""
3056
 
    takes_options = ['revision',
3057
 
                     Option('long', help='Produce long-format testament'), 
3058
 
                     Option('strict', help='Produce a strict-format'
3059
 
                            ' testament')]
 
3066
    takes_options = [
 
3067
            'revision',
 
3068
            Option('long', help='Produce long-format testament.'),
 
3069
            Option('strict',
 
3070
                   help='Produce a strict-format testament.')]
3060
3071
    takes_args = ['branch?']
3061
3072
    @display_command
3062
3073
    def run(self, branch=u'.', revision=None, long=False, strict=False):
3095
3106
    #       with new uncommitted lines marked
3096
3107
    aliases = ['ann', 'blame', 'praise']
3097
3108
    takes_args = ['filename']
3098
 
    takes_options = [Option('all', help='show annotations on all lines'),
3099
 
                     Option('long', help='show date in annotations'),
 
3109
    takes_options = [Option('all', help='Show annotations on all lines.'),
 
3110
                     Option('long', help='Show commit date in annotations.'),
3100
3111
                     'revision',
3101
3112
                     'show-ids',
3102
3113
                     ]
3232
3243
    # information in shared branches as well.
3233
3244
    _see_also = ['commit']
3234
3245
    takes_options = ['verbose', 'revision',
3235
 
                    Option('dry-run', help='Don\'t actually make changes'),
 
3246
                    Option('dry-run', help='Don\'t actually make changes.'),
3236
3247
                    Option('force', help='Say yes to all questions.')]
3237
3248
    takes_args = ['location?']
3238
3249
    aliases = []
3342
3353
 
3343
3354
    takes_options = [
3344
3355
        Option('inet',
3345
 
               help='serve on stdin/out for use from inetd or sshd'),
 
3356
               help='Serve on stdin/out for use from inetd or sshd.'),
3346
3357
        Option('port',
3347
 
               help='listen for connections on nominated port of the form '
3348
 
                    '[hostname:]portnumber. Passing 0 as the port number will '
3349
 
                    'result in a dynamically allocated port. Default port is '
 
3358
               help='Listen for connections on nominated port of the form '
 
3359
                    '[hostname:]portnumber.  Passing 0 as the port number will '
 
3360
                    'result in a dynamically allocated port.  The default port is '
3350
3361
                    '4155.',
3351
3362
               type=str),
3352
3363
        Option('directory',
3353
 
               help='serve contents of directory',
 
3364
               help='Serve contents of this directory.',
3354
3365
               type=unicode),
3355
3366
        Option('allow-writes',
3356
 
               help='By default the server is a readonly server. Supplying '
 
3367
               help='By default the server is a readonly server.  Supplying '
3357
3368
                    '--allow-writes enables write access to the contents of '
3358
 
                    'the served directory and below. '
 
3369
                    'the served directory and below.'
3359
3370
                ),
3360
3371
        ]
3361
3372
 
3421
3432
 
3422
3433
    _see_also = ['split']
3423
3434
    takes_args = ['tree']
3424
 
    takes_options = [Option('reference', 'join by reference')]
 
3435
    takes_options = [
 
3436
            Option('reference', help='Join by reference.'),
 
3437
            ]
3425
3438
    hidden = True
3426
3439
 
3427
3440
    def run(self, tree, reference=False):