~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2007-04-20 15:05:22 UTC
  • mfrom: (2428 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2438.
  • Revision ID: john@arbash-meinel.com-20070420150522-lpbhxv739kynwyep
[merge] bzr.dev 2428

Show diffs side-by-side

added added

removed removed

Lines of Context:
189
189
    aliases = ['st', 'stat']
190
190
 
191
191
    encoding_type = 'replace'
 
192
    _see_also = ['diff', 'revert']
192
193
    
193
194
    @display_command
194
195
    def run(self, show_ids=False, file_list=None, revision=None, short=False,
218
219
    @display_command
219
220
    def run(self, revision_id=None, revision=None):
220
221
 
 
222
        revision_id = osutils.safe_revision_id(revision_id, warn=False)
221
223
        if revision_id is not None and revision is not None:
222
224
            raise errors.BzrCommandError('You can only supply one of'
223
225
                                         ' revision_id or --revision')
243
245
 
244
246
    Since a lightweight checkout is little more than a working tree
245
247
    this will refuse to run against one.
 
248
 
 
249
    To re-create the working tree, use "bzr checkout".
246
250
    """
 
251
    _see_also = ['checkout']
247
252
 
248
253
    takes_args = ['location?']
249
254
 
273
278
    This is equal to the number of revisions on this branch.
274
279
    """
275
280
 
 
281
    _see_also = ['info']
276
282
    takes_args = ['location?']
277
283
 
278
284
    @display_command
338
344
 
339
345
    --file-ids-from will try to use the file ids from the supplied path.
340
346
    It looks up ids trying to find a matching parent directory with the
341
 
    same filename, and then by pure path.
 
347
    same filename, and then by pure path. This option is rarely needed
 
348
    but can be useful when adding the same logical file into two
 
349
    branches that will be merged later (without showing the two different
 
350
    adds as a conflict). It is also useful when merging another project
 
351
    into a subdirectory of this one.
342
352
    """
343
353
    takes_args = ['file*']
344
354
    takes_options = ['no-recurse', 'dry-run', 'verbose',
345
355
                     Option('file-ids-from', type=unicode,
346
356
                            help='Lookup file ids from here')]
347
357
    encoding_type = 'replace'
 
358
    _see_also = ['remove']
348
359
 
349
360
    def run(self, file_list, no_recurse=False, dry_run=False, verbose=False,
350
361
            file_ids_from=None):
429
440
 
430
441
    It is also possible to restrict the list of files to a specific
431
442
    set. For example: bzr inventory --show-ids this/file
432
 
 
433
 
    See also: bzr ls
434
443
    """
435
444
 
436
445
    hidden = True
437
 
 
 
446
    _see_also = ['ls']
438
447
    takes_options = ['revision', 'show-ids', 'kind']
439
 
 
440
448
    takes_args = ['file*']
441
449
 
442
450
    @display_command
553
561
    location can be accessed.
554
562
    """
555
563
 
 
564
    _see_also = ['push', 'update']
556
565
    takes_options = ['remember', 'overwrite', 'revision', 'verbose',
557
566
        Option('directory',
558
567
            help='branch to pull into, '
659
668
    location can be accessed.
660
669
    """
661
670
 
 
671
    _see_also = ['pull', 'update']
662
672
    takes_options = ['remember', 'overwrite', 'verbose',
663
673
        Option('create-prefix',
664
674
               help='Create the path leading up to the branch '
841
851
    To retrieve the branch as of a particular revision, supply the --revision
842
852
    parameter, as in "branch foo/bar -r 5".
843
853
    """
 
854
 
 
855
    _see_also = ['checkout']
844
856
    takes_args = ['from_location', 'to_location?']
845
857
    takes_options = ['revision']
846
858
    aliases = ['get', 'clone']
909
921
    parameter, as in "checkout foo/bar -r 5". Note that this will be immediately
910
922
    out of date [so you cannot commit] but it may be useful (i.e. to examine old
911
923
    code.)
 
924
    """
912
925
 
913
 
    See "help checkouts" for more information on checkouts.
914
 
    """
 
926
    _see_also = ['checkouts', 'branch']
915
927
    takes_args = ['branch_location?', 'to_location?']
916
928
    takes_options = ['revision',
917
929
                     Option('lightweight',
971
983
    # TODO: Option to show renames between two historical versions.
972
984
 
973
985
    # TODO: Only show renames under dir, rather than in the whole branch.
 
986
    _see_also = ['status']
974
987
    takes_args = ['dir?']
975
988
 
976
989
    @display_command
1003
1016
    If you want to discard your local changes, you can just do a 
1004
1017
    'bzr revert' instead of 'bzr commit' after the update.
1005
1018
    """
 
1019
 
 
1020
    _see_also = ['pull']
1006
1021
    takes_args = ['dir?']
1007
1022
    aliases = ['up']
1008
1023
 
1046
1061
 
1047
1062
    Branches and working trees will also report any missing revisions.
1048
1063
    """
 
1064
    _see_also = ['revno']
1049
1065
    takes_args = ['location?']
1050
1066
    takes_options = ['verbose']
1051
1067
 
1096
1112
    """
1097
1113
 
1098
1114
    hidden = True
 
1115
    _see_also = ['inventory', 'ls']
1099
1116
    takes_args = ['filename']
1100
1117
 
1101
1118
    @display_command
1148
1165
 
1149
1166
    The branch *MUST* be on a listable system such as local disk or sftp.
1150
1167
    """
 
1168
 
 
1169
    _see_also = ['check']
1151
1170
    takes_args = ['branch?']
1152
1171
 
1153
1172
    def run(self, branch="."):
1158
1177
 
1159
1178
class cmd_revision_history(Command):
1160
1179
    """Display the list of revision ids on a branch."""
 
1180
 
 
1181
    _see_also = ['log']
1161
1182
    takes_args = ['location?']
1162
1183
 
1163
1184
    hidden = True
1172
1193
 
1173
1194
class cmd_ancestry(Command):
1174
1195
    """List all revisions merged into this branch."""
 
1196
 
 
1197
    _see_also = ['log', 'revision-history']
1175
1198
    takes_args = ['location?']
1176
1199
 
1177
1200
    hidden = True
1215
1238
        bzr status
1216
1239
        bzr commit -m 'imported project'
1217
1240
    """
 
1241
 
 
1242
    _see_also = ['init-repo', 'branch', 'checkout']
1218
1243
    takes_args = ['location?']
1219
1244
    takes_options = [
1220
1245
         RegistryOption('format',
1286
1311
        (add files here)
1287
1312
    """
1288
1313
 
 
1314
    _see_also = ['init', 'branch', 'checkout']
1289
1315
    takes_args = ["location"]
1290
1316
    takes_options = [RegistryOption('format',
1291
1317
                            help='Specify a format for this repository. See'
1351
1377
 
1352
1378
    # TODO: This probably handles non-Unix newlines poorly.
1353
1379
 
 
1380
    _see_also = ['status']
1354
1381
    takes_args = ['file*']
1355
1382
    takes_options = ['revision', 'diff-options',
1356
1383
        Option('prefix', type=str,
1436
1463
    # directories with readdir, rather than stating each one.  Same
1437
1464
    # level of effort but possibly much less IO.  (Or possibly not,
1438
1465
    # if the directories are very large...)
 
1466
    _see_also = ['status', 'ls']
1439
1467
    takes_options = ['show-ids']
1440
1468
 
1441
1469
    @display_command
1461
1489
 
1462
1490
class cmd_modified(Command):
1463
1491
    """List files modified in working tree.
1464
 
 
1465
 
    See also: "bzr status".
1466
1492
    """
1467
1493
 
1468
1494
    hidden = True
 
1495
    _see_also = ['status', 'ls']
1469
1496
 
1470
1497
    @display_command
1471
1498
    def run(self):
1477
1504
 
1478
1505
class cmd_added(Command):
1479
1506
    """List files added in working tree.
1480
 
 
1481
 
    See also: "bzr status".
1482
1507
    """
1483
1508
 
1484
1509
    hidden = True
 
1510
    _see_also = ['status', 'ls']
1485
1511
 
1486
1512
    @display_command
1487
1513
    def run(self):
1513
1539
 
1514
1540
    The root is the nearest enclosing directory with a .bzr control
1515
1541
    directory."""
 
1542
 
1516
1543
    takes_args = ['filename?']
1517
1544
    @display_command
1518
1545
    def run(self, filename=None):
1680
1707
    """List files in a tree.
1681
1708
    """
1682
1709
 
 
1710
    _see_also = ['status', 'cat']
1683
1711
    takes_args = ['path?']
1684
1712
    # TODO: Take a revision or remote path and list that tree instead.
1685
1713
    takes_options = ['verbose', 'revision',
1769
1797
 
1770
1798
class cmd_unknowns(Command):
1771
1799
    """List unknown files.
1772
 
 
1773
 
    See also: "bzr ls --unknown".
1774
1800
    """
1775
1801
 
1776
1802
    hidden = True
 
1803
    _see_also = ['ls']
1777
1804
 
1778
1805
    @display_command
1779
1806
    def run(self):
1814
1841
        bzr ignore 'lib/**/*.o'
1815
1842
        bzr ignore 'RE:lib/.*\.o'
1816
1843
    """
 
1844
 
 
1845
    _see_also = ['status', 'ignored']
1817
1846
    takes_args = ['name_pattern*']
1818
1847
    takes_options = [
1819
1848
                     Option('old-default-rules',
1869
1898
 
1870
1899
class cmd_ignored(Command):
1871
1900
    """List ignored files and the patterns that matched them.
 
1901
    """
1872
1902
 
1873
 
    See also: bzr ignore"""
 
1903
    _see_also = ['ignore']
1874
1904
    @display_command
1875
1905
    def run(self):
1876
1906
        tree = WorkingTree.open_containing(u'.')[0]
1914
1944
    given, try to find the format with the extension. If no extension
1915
1945
    is found exports to a directory (equivalent to --format=dir).
1916
1946
 
1917
 
    Root may be the top directory for tar, tgz and tbz2 formats. If none
1918
 
    is given, the top directory will be the root name of the file.
 
1947
    If root is supplied, it will be used as the root directory inside
 
1948
    container formats (tar, zip, etc). If it is not supplied it will default
 
1949
    to the exported filename. The root option has no effect for 'dir' format.
1919
1950
 
1920
1951
    If branch is omitted then the branch containing the current working
1921
1952
    directory will be used.
1922
1953
 
1923
 
    Note: export of tree with non-ascii filenames to zip is not supported.
 
1954
    Note: Export of tree with non-ASCII filenames to zip is not supported.
1924
1955
 
1925
1956
     Supported formats       Autodetected by extension
1926
1957
     -----------------       -------------------------
1964
1995
    binary file. 
1965
1996
    """
1966
1997
 
 
1998
    _see_also = ['ls']
1967
1999
    takes_options = ['revision', 'name-from-revision']
1968
2000
    takes_args = ['filename']
1969
2001
    encoding_type = 'exact'
2028
2060
    within it is committed.
2029
2061
 
2030
2062
    A selected-file commit may fail in some cases where the committed
2031
 
    tree would be invalid, such as trying to commit a file in a
2032
 
    newly-added directory that is not itself committed.
 
2063
    tree would be invalid. Consider::
 
2064
 
 
2065
      bzr init foo
 
2066
      mkdir foo/bar
 
2067
      bzr add foo/bar
 
2068
      bzr commit foo -m "committing foo"
 
2069
      bzr mv foo/bar foo/baz
 
2070
      mkdir foo/bar
 
2071
      bzr add foo/bar
 
2072
      bzr commit foo/bar -m "committing bar but not baz"
 
2073
 
 
2074
    In the example above, the last commit will fail by design. This gives
 
2075
    the user the opportunity to decide whether they want to commit the
 
2076
    rename at the same time, separately first, or not at all. (As a general
 
2077
    rule, when in doubt, Bazaar has a policy of Doing the Safe Thing.)
 
2078
 
 
2079
    Note: A selected-file commit after a merge is not yet supported.
2033
2080
    """
2034
2081
    # TODO: Run hooks on tree to-be-committed, and after commit.
2035
2082
 
2040
2087
 
2041
2088
    # XXX: verbose currently does nothing
2042
2089
 
 
2090
    _see_also = ['uncommit']
2043
2091
    takes_args = ['selected*']
2044
2092
    takes_options = ['message', 'verbose', 
2045
2093
                     Option('unchanged',
2137
2185
    This command checks various invariants about the branch storage to
2138
2186
    detect data corruption or bzr bugs.
2139
2187
    """
 
2188
 
 
2189
    _see_also = ['reconcile']
2140
2190
    takes_args = ['branch?']
2141
2191
    takes_options = ['verbose']
2142
2192
 
2157
2207
    this command. When the default format has changed you may also be warned
2158
2208
    during other operations to upgrade.
2159
2209
    """
 
2210
 
 
2211
    _see_also = ['check']
2160
2212
    takes_args = ['url?']
2161
2213
    takes_options = [
2162
2214
                    RegistryOption('format',
2225
2277
    If unset, the tree root directory name is used as the nickname
2226
2278
    To print the current nickname, execute with no argument.  
2227
2279
    """
 
2280
 
 
2281
    _see_also = ['info']
2228
2282
    takes_args = ['nickname?']
2229
2283
    def run(self, nickname=None):
2230
2284
        branch = Branch.open_containing(u'.')[0]
2294
2348
    hidden = True
2295
2349
    takes_args = ['testspecs*']
2296
2350
    takes_options = ['verbose',
2297
 
                     Option('one', help='stop when one test fails'),
 
2351
                     Option('one',
 
2352
                             help='stop when one test fails',
 
2353
                             short_name='1',
 
2354
                             ),
2298
2355
                     Option('keep-output',
2299
2356
                            help='keep output directories when tests fail'),
2300
2357
                     Option('transport',
2312
2369
                            help='clean temporary tests directories'
2313
2370
                                 ' without running tests'),
2314
2371
                     Option('first',
2315
 
                            help='run all tests, but run specified tests first'
 
2372
                            help='run all tests, but run specified tests first',
 
2373
                            short_name='f',
2316
2374
                            ),
2317
2375
                     Option('numbered-dirs',
2318
2376
                            help='use numbered dirs for TestCaseInTempDir'),
2453
2511
 
2454
2512
    Examples:
2455
2513
 
2456
 
    To merge the latest revision from bzr.dev
2457
 
    bzr merge ../bzr.dev
 
2514
    To merge the latest revision from bzr.dev:
 
2515
        bzr merge ../bzr.dev
2458
2516
 
2459
 
    To merge changes up to and including revision 82 from bzr.dev
2460
 
    bzr merge -r 82 ../bzr.dev
 
2517
    To merge changes up to and including revision 82 from bzr.dev:
 
2518
        bzr merge -r 82 ../bzr.dev
2461
2519
 
2462
2520
    To merge the changes introduced by 82, without previous changes:
2463
 
    bzr merge -r 81..82 ../bzr.dev
 
2521
        bzr merge -r 81..82 ../bzr.dev
2464
2522
    
2465
2523
    merge refuses to run if there are any uncommitted changes, unless
2466
2524
    --force is given.
2467
2525
    """
 
2526
 
 
2527
    _see_also = ['update', 'remerge']
2468
2528
    takes_args = ['branch?']
2469
2529
    takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
2470
2530
        Option('show-base', help="Show base revision text in "
2632
2692
    pending merge, and it lets you specify particular files.
2633
2693
 
2634
2694
    Examples:
 
2695
 
2635
2696
    $ bzr remerge --show-base
2636
2697
        Re-do the merge of all conflicted files, and show the base text in
2637
2698
        conflict regions, in addition to the usual THIS and OTHER texts.
2729
2790
    name.  If you name a directory, all the contents of that directory will be
2730
2791
    reverted.
2731
2792
    """
 
2793
 
 
2794
    _see_also = ['cat', 'export']
2732
2795
    takes_options = ['revision', 'no-backup']
2733
2796
    takes_args = ['file*']
2734
2797
 
2768
2831
 
2769
2832
class cmd_help(Command):
2770
2833
    """Show help on a command or other topic.
 
2834
    """
2771
2835
 
2772
 
    For a list of all available commands, say 'bzr help commands'.
2773
 
    """
 
2836
    _see_also = ['topics']
2774
2837
    takes_options = [Option('long', 'show help on all commands')]
2775
2838
    takes_args = ['topic?']
2776
2839
    aliases = ['?', '--help', '-?', '-h']
2817
2880
 
2818
2881
    OTHER_BRANCH may be local or remote.
2819
2882
    """
 
2883
 
 
2884
    _see_also = ['merge', 'pull']
2820
2885
    takes_args = ['other_branch?']
2821
2886
    takes_options = [Option('reverse', 'Reverse the order of revisions'),
2822
2887
                     Option('mine-only', 
2919
2984
 
2920
2985
class cmd_testament(Command):
2921
2986
    """Show testament (signing-form) of a revision."""
2922
 
    takes_options = ['revision', 
 
2987
    takes_options = ['revision',
2923
2988
                     Option('long', help='Produce long-format testament'), 
2924
2989
                     Option('strict', help='Produce a strict-format'
2925
2990
                            ' testament')]
3035
3100
 
3036
3101
    Once converted into a checkout, commits must succeed on the master branch
3037
3102
    before they will be applied to the local branch.
3038
 
 
3039
 
    See "help checkouts" for more information on checkouts.
3040
3103
    """
3041
3104
 
 
3105
    _see_also = ['checkouts', 'unbind']
3042
3106
    takes_args = ['location?']
3043
3107
    takes_options = []
3044
3108
 
3067
3131
 
3068
3132
    After unbinding, the local branch is considered independent and subsequent
3069
3133
    commits will be local only.
3070
 
 
3071
 
    See "help checkouts" for more information on checkouts.
3072
3134
    """
3073
3135
 
 
3136
    _see_also = ['checkouts', 'bind']
3074
3137
    takes_args = []
3075
3138
    takes_options = []
3076
3139
 
3095
3158
    # unreferenced information in 'branch-as-repository' branches.
3096
3159
    # TODO: jam 20060108 Add the ability for uncommit to remove unreferenced
3097
3160
    # information in shared branches as well.
 
3161
    _see_also = ['commit']
3098
3162
    takes_options = ['verbose', 'revision',
3099
3163
                    Option('dry-run', help='Don\'t actually make changes'),
3100
3164
                    Option('force', help='Say yes to all questions.')]
3251
3315
            sys.stdout.flush()
3252
3316
        smart_server.serve()
3253
3317
 
 
3318
 
3254
3319
class cmd_join(Command):
3255
3320
    """Combine a subtree into its containing tree.
3256
3321
    
3272
3337
    and merge, will recurse into the subtree.
3273
3338
    """
3274
3339
 
 
3340
    _see_also = ['split']
3275
3341
    takes_args = ['tree']
3276
3342
    takes_options = [Option('reference', 'join by reference')]
3277
3343
    hidden = True
3313
3379
    subdirectory will be converted into an independent tree, with its own
3314
3380
    branch.  Commits in the top-level tree will not apply to the new subtree.
3315
3381
    If you want that behavior, do "bzr join --reference TREE".
3316
 
 
3317
 
    To undo this operation, do "bzr join TREE".
3318
3382
    """
3319
3383
 
 
3384
    _see_also = ['join']
3320
3385
    takes_args = ['tree']
3321
3386
 
3322
3387
    hidden = True
3432
3497
    --force, in which case the tag is moved to point to the new revision.
3433
3498
    """
3434
3499
 
 
3500
    _see_also = ['commit', 'tags']
3435
3501
    takes_args = ['tag_name']
3436
3502
    takes_options = [
3437
3503
        Option('delete',
3483
3549
    This tag shows a table of tag names and the revisions they reference.
3484
3550
    """
3485
3551
 
 
3552
    _see_also = ['tag']
3486
3553
    takes_options = [
3487
3554
        Option('directory',
3488
3555
            help='Branch whose tags should be displayed',