/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Aaron Bentley
  • Date: 2007-07-12 20:43:51 UTC
  • mfrom: (2609 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2617.
  • Revision ID: abentley@panoramicfeedback.com-20070712204351-d1vl9j526yscbfq3
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    osutils,
45
45
    registry,
46
46
    repository,
 
47
    revision as _mod_revision,
47
48
    revisionspec,
48
49
    symbol_versioning,
49
50
    transport,
338
339
    into a subdirectory of this one.
339
340
    """
340
341
    takes_args = ['file*']
341
 
    takes_options = ['no-recurse', 'dry-run', 'verbose',
342
 
                     Option('file-ids-from', type=unicode,
343
 
                            help='Lookup file ids from this tree.')]
 
342
    takes_options = [
 
343
        Option('no-recurse',
 
344
               help="Don't recursively add the contents of directories."),
 
345
        Option('dry-run',
 
346
               help="Show what would be done, but don't actually do anything."),
 
347
        'verbose',
 
348
        Option('file-ids-from',
 
349
               type=unicode,
 
350
               help='Lookup file ids from this tree.'),
 
351
        ]
344
352
    encoding_type = 'replace'
345
353
    _see_also = ['remove']
346
354
 
436
444
 
437
445
    hidden = True
438
446
    _see_also = ['ls']
439
 
    takes_options = ['revision', 'show-ids', 'kind']
 
447
    takes_options = [
 
448
        'revision',
 
449
        'show-ids',
 
450
        Option('kind',
 
451
               help='List entries of a particular kind: file, directory, symlink.',
 
452
               type=unicode),
 
453
        ]
440
454
    takes_args = ['file*']
441
455
 
442
456
    @display_command
443
457
    def run(self, revision=None, show_ids=False, kind=None, file_list=None):
444
458
        if kind and kind not in ['file', 'directory', 'symlink']:
445
 
            raise errors.BzrCommandError('invalid kind specified')
 
459
            raise errors.BzrCommandError('invalid kind %r specified' % (kind,))
446
460
 
447
461
        work_tree, file_list = tree_files(file_list)
448
462
        work_tree.lock_read()
741
755
                        "\nYou may supply --create-prefix to create all"
742
756
                        " leading parent directories."
743
757
                        % location)
744
 
 
745
758
                _create_prefix(to_transport)
746
759
 
747
760
            # Now the target directory exists, but doesn't have a .bzr
1010
1023
            tree.lock_tree_write()
1011
1024
        try:
1012
1025
            existing_pending_merges = tree.get_parent_ids()[1:]
1013
 
            last_rev = tree.last_revision()
1014
 
            if last_rev == tree.branch.last_revision():
 
1026
            last_rev = _mod_revision.ensure_null(tree.last_revision())
 
1027
            if last_rev == _mod_revision.ensure_null(
 
1028
                tree.branch.last_revision()):
1015
1029
                # may be up to date, check master too.
1016
1030
                master = tree.branch.get_master_branch()
1017
 
                if master is None or last_rev == master.last_revision():
 
1031
                if master is None or last_rev == _mod_revision.ensure_null(
 
1032
                    master.last_revision()):
1018
1033
                    revno = tree.branch.revision_id_to_revno(last_rev)
1019
1034
                    note("Tree is up to date at revision %d." % (revno,))
1020
1035
                    return 0
1021
1036
            conflicts = tree.update(delta._ChangeReporter(
1022
1037
                                        unversioned_filter=tree.is_ignored))
1023
 
            revno = tree.branch.revision_id_to_revno(tree.last_revision())
 
1038
            revno = tree.branch.revision_id_to_revno(
 
1039
                _mod_revision.ensure_null(tree.last_revision()))
1024
1040
            note('Updated to revision %d.' % (revno,))
1025
1041
            if tree.get_parent_ids()[1:] != existing_pending_merges:
1026
1042
                note('Your local commits will now show as pending merges with '
1386
1402
 
1387
1403
    _see_also = ['status']
1388
1404
    takes_args = ['file*']
1389
 
    takes_options = ['revision', 'diff-options',
 
1405
    takes_options = [
 
1406
        Option('diff-options', type=str,
 
1407
               help='Pass these options to the external diff program.'),
1390
1408
        Option('prefix', type=str,
1391
1409
               short_name='p',
1392
1410
               help='Set prefixes to added to old and new filenames, as '
1393
1411
                    'two values separated by a colon. (eg "old/:new/").'),
 
1412
        'revision',
1394
1413
        ]
1395
1414
    aliases = ['di', 'dif']
1396
1415
    encoding_type = 'exact'
1584
1603
    takes_options = [
1585
1604
            Option('forward',
1586
1605
                   help='Show from oldest to newest.'),
1587
 
            'timezone',
 
1606
            Option('timezone',
 
1607
                   type=str,
 
1608
                   help='Display timezone as local, original, or utc.'),
1588
1609
            Option('verbose',
1589
1610
                   short_name='v',
1590
1611
                   help='Show files changed in each revision.'),
1732
1753
            Option('null',
1733
1754
                   help='Write an ascii NUL (\\0) separator '
1734
1755
                   'between files rather than a newline.'),
1735
 
            'kind',
 
1756
            Option('kind',
 
1757
                   help='List entries of a particular kind: file, directory, symlink.',
 
1758
                   type=unicode),
1736
1759
            'show-ids',
1737
1760
            ]
1738
1761
    @display_command
1739
 
    def run(self, revision=None, verbose=False, 
 
1762
    def run(self, revision=None, verbose=False,
1740
1763
            non_recursive=False, from_root=False,
1741
1764
            unknown=False, versioned=False, ignored=False,
1742
1765
            null=False, kind=None, show_ids=False, path=None):
1975
1998
         zip                          .zip
1976
1999
    """
1977
2000
    takes_args = ['dest', 'branch?']
1978
 
    takes_options = ['revision', 'format', 'root']
 
2001
    takes_options = [
 
2002
        Option('format',
 
2003
               help="Type of file to export to.",
 
2004
               type=unicode),
 
2005
        'revision',
 
2006
        Option('root',
 
2007
               type=str,
 
2008
               help="Name of the root directory inside the exported file."),
 
2009
        ]
1979
2010
    def run(self, dest, branch=None, revision=None, format=None, root=None):
1980
2011
        from bzrlib.export import export
1981
2012
 
2009
2040
    """
2010
2041
 
2011
2042
    _see_also = ['ls']
2012
 
    takes_options = ['revision', 'name-from-revision']
 
2043
    takes_options = [
 
2044
        Option('name-from-revision', help='The path name in the old tree.'),
 
2045
        'revision',
 
2046
        ]
2013
2047
    takes_args = ['filename']
2014
2048
    encoding_type = 'exact'
2015
2049
 
2103
2137
    _see_also = ['bugs', 'uncommit']
2104
2138
    takes_args = ['selected*']
2105
2139
    takes_options = [
2106
 
            'message',
 
2140
            Option('message', type=unicode,
 
2141
                   short_name='m',
 
2142
                   help="Description of the new revision."),
2107
2143
            'verbose',
2108
2144
             Option('unchanged',
2109
2145
                    help='Commit even if nothing has changed.'),
2369
2405
    modified by plugins will not be tested, and tests provided by plugins will
2370
2406
    not be run.
2371
2407
 
 
2408
    Tests that need working space on disk use a common temporary directory, 
 
2409
    typically inside $TMPDIR or /tmp.
 
2410
 
2372
2411
    examples::
2373
2412
        bzr selftest ignore
2374
2413
            run only tests relating to 'ignore'
2375
2414
        bzr --no-plugins selftest -v
2376
2415
            disable plugins and list tests as they're run
2377
 
 
2378
 
    For each test, that needs actual disk access, bzr create their own
2379
 
    subdirectory in the temporary testing directory (testXXXX.tmp).
2380
 
    By default the name of such subdirectory is based on the name of the test.
2381
 
    If option '--numbered-dirs' is given, bzr will use sequent numbers
2382
 
    of running tests to create such subdirectories. This is default behavior
2383
 
    on Windows because of path length limitation.
2384
2416
    """
2385
2417
    # NB: this is used from the class without creating an instance, which is
2386
2418
    # why it does not have a self parameter.
2406
2438
                             help='Stop when one test fails.',
2407
2439
                             short_name='1',
2408
2440
                             ),
2409
 
                     Option('keep-output',
2410
 
                            help='Keep output directories when tests fail.'),
2411
2441
                     Option('transport',
2412
2442
                            help='Use a different transport by default '
2413
2443
                                 'throughout the test suite.',
2420
2450
                     Option('cache-dir', type=str,
2421
2451
                            help='Cache intermediate benchmark output in this '
2422
2452
                                 'directory.'),
2423
 
                     Option('clean-output',
2424
 
                            help='Clean temporary tests directories'
2425
 
                                 ' without running tests.'),
2426
2453
                     Option('first',
2427
2454
                            help='Run all tests, but run specified tests first.',
2428
2455
                            short_name='f',
2429
2456
                            ),
2430
 
                     Option('numbered-dirs',
2431
 
                            help='Use numbered dirs for TestCaseInTempDir.'),
2432
2457
                     Option('list-only',
2433
2458
                            help='List the tests instead of running them.'),
2434
2459
                     Option('randomize', type=str, argname="SEED",
2442
2467
    encoding_type = 'replace'
2443
2468
 
2444
2469
    def run(self, testspecs_list=None, verbose=None, one=False,
2445
 
            keep_output=False, transport=None, benchmark=None,
2446
 
            lsprof_timed=None, cache_dir=None, clean_output=False,
2447
 
            first=False, numbered_dirs=None, list_only=False,
 
2470
            transport=None, benchmark=None,
 
2471
            lsprof_timed=None, cache_dir=None,
 
2472
            first=False, list_only=False,
2448
2473
            randomize=None, exclude=None):
2449
2474
        import bzrlib.ui
2450
2475
        from bzrlib.tests import selftest
2451
2476
        import bzrlib.benchmarks as benchmarks
2452
2477
        from bzrlib.benchmarks import tree_creator
2453
2478
 
2454
 
        if clean_output:
2455
 
            from bzrlib.tests import clean_selftest_output
2456
 
            clean_selftest_output()
2457
 
            return 0
2458
 
        if keep_output:
2459
 
            warning("notice: selftest --keep-output "
2460
 
                    "is no longer supported; "
2461
 
                    "test output is always removed")
2462
 
 
2463
 
        if numbered_dirs is None and sys.platform == 'win32':
2464
 
            numbered_dirs = True
2465
 
 
2466
2479
        if cache_dir is not None:
2467
2480
            tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
2468
2481
        print '%10s: %s' % ('bzr', osutils.realpath(sys.argv[0]))
2484
2497
                verbose = False
2485
2498
            benchfile = None
2486
2499
        try:
2487
 
            result = selftest(verbose=verbose, 
 
2500
            result = selftest(verbose=verbose,
2488
2501
                              pattern=pattern,
2489
 
                              stop_on_failure=one, 
 
2502
                              stop_on_failure=one,
2490
2503
                              transport=transport,
2491
2504
                              test_suite_factory=test_suite_factory,
2492
2505
                              lsprof_timed=lsprof_timed,
2493
2506
                              bench_history=benchfile,
2494
2507
                              matching_tests_first=first,
2495
 
                              numbered_dirs=numbered_dirs,
2496
2508
                              list_only=list_only,
2497
2509
                              random_seed=randomize,
2498
2510
                              exclude_pattern=exclude
2595
2607
 
2596
2608
    _see_also = ['update', 'remerge', 'status-flags']
2597
2609
    takes_args = ['branch?']
2598
 
    takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
 
2610
    takes_options = [
 
2611
        'revision',
 
2612
        Option('force',
 
2613
               help='Merge even if the destination tree has uncommitted changes.'),
 
2614
        'merge-type',
 
2615
        'reprocess',
 
2616
        'remember',
2599
2617
        Option('show-base', help="Show base revision text in "
2600
2618
               "conflicts."),
2601
2619
        Option('uncommitted', help='Apply uncommitted changes'
2605
2623
                ' source rather than merging.  When this happens,'
2606
2624
                ' you do not need to commit the result.'),
2607
2625
        Option('directory',
2608
 
            help='Branch to merge into, '
2609
 
                 'rather than the one containing the working directory.',
2610
 
            short_name='d',
2611
 
            type=unicode,
2612
 
            ),
 
2626
               help='Branch to merge into, '
 
2627
                    'rather than the one containing the working directory.',
 
2628
               short_name='d',
 
2629
               type=unicode,
 
2630
               ),
2613
2631
    ]
2614
2632
 
2615
2633
    def run(self, branch=None, revision=None, force=False, merge_type=None,
2864
2882
    """
2865
2883
 
2866
2884
    _see_also = ['cat', 'export']
2867
 
    takes_options = ['revision', 'no-backup']
 
2885
    takes_options = [
 
2886
            'revision',
 
2887
            Option('no-backup', "Do not save backups of reverted files."),
 
2888
            ]
2868
2889
    takes_args = ['file*']
2869
2890
 
2870
2891
    def run(self, revision=None, no_backup=False, file_list=None):
3775
3796
    while True:
3776
3797
        new_transport = cur_transport.clone('..')
3777
3798
        if new_transport.base == cur_transport.base:
3778
 
            raise errors.BzrCommandError("Failed to create path"
3779
 
                                         " prefix for %s."
3780
 
                                         % location)
 
3799
            raise errors.BzrCommandError(
 
3800
                "Failed to create path prefix for %s."
 
3801
                % cur_transport.base)
3781
3802
        try:
3782
3803
            new_transport.mkdir('.')
3783
3804
        except errors.NoSuchFile:
3785
3806
            cur_transport = new_transport
3786
3807
        else:
3787
3808
            break
3788
 
 
3789
3809
    # Now we only need to create child directories
3790
3810
    while needed:
3791
3811
        cur_transport = needed.pop()
3792
3812
        cur_transport.ensure_base()
3793
3813
 
 
3814
 
3794
3815
# Compatibility
3795
3816
merge = _merge_helper
3796
3817