~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Move all features to bzrlib.tests.features in 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    ui,
50
50
    urlutils,
51
51
    views,
 
52
    gpg,
52
53
    )
53
54
from bzrlib.branch import Branch
54
55
from bzrlib.conflicts import ConflictList
231
232
    unknown
232
233
        Not versioned and not matching an ignore pattern.
233
234
 
234
 
    Additionally for directories, symlinks and files with an executable
235
 
    bit, Bazaar indicates their type using a trailing character: '/', '@'
236
 
    or '*' respectively.
 
235
    Additionally for directories, symlinks and files with a changed
 
236
    executable bit, Bazaar indicates their type using a trailing
 
237
    character: '/', '@' or '*' respectively. These decorations can be
 
238
    disabled using the '--no-classify' option.
237
239
 
238
240
    To see ignored files use 'bzr ignored'.  For details on the
239
241
    changes to file texts, use 'bzr diff'.
270
272
                            short_name='V'),
271
273
                     Option('no-pending', help='Don\'t show pending merges.',
272
274
                           ),
 
275
                     Option('no-classify',
 
276
                            help='Do not mark object type using indicator.',
 
277
                           ),
273
278
                     ]
274
279
    aliases = ['st', 'stat']
275
280
 
278
283
 
279
284
    @display_command
280
285
    def run(self, show_ids=False, file_list=None, revision=None, short=False,
281
 
            versioned=False, no_pending=False, verbose=False):
 
286
            versioned=False, no_pending=False, verbose=False,
 
287
            no_classify=False):
282
288
        from bzrlib.status import show_tree_status
283
289
 
284
290
        if revision and len(revision) > 2:
298
304
        show_tree_status(tree, show_ids=show_ids,
299
305
                         specific_files=relfile_list, revision=revision,
300
306
                         to_file=self.outf, short=short, versioned=versioned,
301
 
                         show_pending=(not no_pending), verbose=verbose)
 
307
                         show_pending=(not no_pending), verbose=verbose,
 
308
                         classify=not no_classify)
302
309
 
303
310
 
304
311
class cmd_cat_revision(Command):
796
803
                                      require_versioned=True)
797
804
            # find_ids_across_trees may include some paths that don't
798
805
            # exist in 'tree'.
799
 
            entries = sorted((tree.id2path(file_id), tree.inventory[file_id])
800
 
                             for file_id in file_ids if file_id in tree)
 
806
            entries = sorted(
 
807
                (tree.id2path(file_id), tree.inventory[file_id])
 
808
                for file_id in file_ids if tree.has_id(file_id))
801
809
        else:
802
810
            entries = tree.inventory.entries()
803
811
 
1740
1748
            b = wt.branch
1741
1749
            last_revision = wt.last_revision()
1742
1750
 
1743
 
        revision_ids = b.repository.get_ancestry(last_revision)
1744
 
        revision_ids.pop(0)
1745
 
        for revision_id in revision_ids:
 
1751
        self.add_cleanup(b.repository.lock_read().unlock)
 
1752
        graph = b.repository.get_graph()
 
1753
        revisions = [revid for revid, parents in
 
1754
            graph.iter_ancestry([last_revision])]
 
1755
        for revision_id in reversed(revisions):
 
1756
            if _mod_revision.is_null(revision_id):
 
1757
                continue
1746
1758
            self.outf.write(revision_id + '\n')
1747
1759
 
1748
1760
 
2150
2162
        basis_inv = basis.inventory
2151
2163
        inv = wt.inventory
2152
2164
        for file_id in inv:
2153
 
            if file_id in basis_inv:
 
2165
            if basis_inv.has_id(file_id):
2154
2166
                continue
2155
2167
            if inv.is_root(file_id) and len(basis_inv) == 0:
2156
2168
                continue
2389
2401
            Option('exclude-common-ancestry',
2390
2402
                   help='Display only the revisions that are not part'
2391
2403
                   ' of both ancestries (require -rX..Y)'
2392
 
                   )
 
2404
                   ),
 
2405
            Option('signatures',
 
2406
                   help='Show digital signature validity'),
2393
2407
            ]
2394
2408
    encoding_type = 'replace'
2395
2409
 
2408
2422
            include_merges=False,
2409
2423
            authors=None,
2410
2424
            exclude_common_ancestry=False,
 
2425
            signatures=False,
2411
2426
            ):
2412
2427
        from bzrlib.log import (
2413
2428
            Logger,
2467
2482
            self.add_cleanup(b.lock_read().unlock)
2468
2483
            rev1, rev2 = _get_revision_range(revision, b, self.name())
2469
2484
 
 
2485
        if b.get_config().validate_signatures_in_log():
 
2486
            signatures = True
 
2487
 
 
2488
        if signatures:
 
2489
            if not gpg.GPGStrategy.verify_signatures_available():
 
2490
                raise errors.GpgmeNotInstalled(None)
 
2491
 
2470
2492
        # Decide on the type of delta & diff filtering to use
2471
2493
        # TODO: add an --all-files option to make this configurable & consistent
2472
2494
        if not verbose:
2518
2540
            message_search=message, delta_type=delta_type,
2519
2541
            diff_type=diff_type, _match_using_deltas=match_using_deltas,
2520
2542
            exclude_common_ancestry=exclude_common_ancestry,
 
2543
            signature=signatures
2521
2544
            )
2522
2545
        Logger(b, rqst).show(lf)
2523
2546
 
6215
6238
        ('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6216
6239
        ('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6217
6240
        ('cmd_conflicts', [], 'bzrlib.conflicts'),
6218
 
        ('cmd_sign_my_commits', [], 'bzrlib.sign_my_commits'),
 
6241
        ('cmd_sign_my_commits', [], 'bzrlib.commit_signature_commands'),
 
6242
        ('cmd_verify_signatures', [],
 
6243
                                        'bzrlib.commit_signature_commands'),
6219
6244
        ('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6220
6245
        ]:
6221
6246
        builtin_command_registry.register_lazy(name, aliases, module_name)