~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-30 16:06:19 UTC
  • mfrom: (5971.1.80 bzr-gpgme)
  • Revision ID: pqm@pqm.ubuntu.com-20110630160619-3022zmfchft893nt
(jr) A new command ``bzr verify-signatures`` has been added to check that
 commits
 are correctly signed with trusted keys by GPG. This requires python-gpgme to
 be installed. ``bzr log`` has gained a ``--signatures`` option to list the
 validity of signatures for each commit. New config options
 ``acceptable_keys``
 and ``validate_signatures_in_log`` can be set to control options to these
 commands. (Jonathan Riddell)

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
2394
2395
            Option('exclude-common-ancestry',
2395
2396
                   help='Display only the revisions that are not part'
2396
2397
                   ' of both ancestries (require -rX..Y)'
2397
 
                   )
 
2398
                   ),
 
2399
            Option('signatures',
 
2400
                   help='Show digital signature validity'),
2398
2401
            ]
2399
2402
    encoding_type = 'replace'
2400
2403
 
2413
2416
            include_merges=False,
2414
2417
            authors=None,
2415
2418
            exclude_common_ancestry=False,
 
2419
            signatures=False,
2416
2420
            ):
2417
2421
        from bzrlib.log import (
2418
2422
            Logger,
2472
2476
            self.add_cleanup(b.lock_read().unlock)
2473
2477
            rev1, rev2 = _get_revision_range(revision, b, self.name())
2474
2478
 
 
2479
        if b.get_config().validate_signatures_in_log():
 
2480
            signatures = True
 
2481
 
 
2482
        if signatures:
 
2483
            if not gpg.GPGStrategy.verify_signatures_available():
 
2484
                raise errors.GpgmeNotInstalled(None)
 
2485
 
2475
2486
        # Decide on the type of delta & diff filtering to use
2476
2487
        # TODO: add an --all-files option to make this configurable & consistent
2477
2488
        if not verbose:
2523
2534
            message_search=message, delta_type=delta_type,
2524
2535
            diff_type=diff_type, _match_using_deltas=match_using_deltas,
2525
2536
            exclude_common_ancestry=exclude_common_ancestry,
 
2537
            signature=signatures
2526
2538
            )
2527
2539
        Logger(b, rqst).show(lf)
2528
2540
 
6220
6232
        ('cmd_version_info', [], 'bzrlib.cmd_version_info'),
6221
6233
        ('cmd_resolve', ['resolved'], 'bzrlib.conflicts'),
6222
6234
        ('cmd_conflicts', [], 'bzrlib.conflicts'),
6223
 
        ('cmd_sign_my_commits', [], 'bzrlib.sign_my_commits'),
 
6235
        ('cmd_sign_my_commits', [], 'bzrlib.commit_signature_commands'),
 
6236
        ('cmd_verify_signatures', [],
 
6237
                                        'bzrlib.commit_signature_commands'),
6224
6238
        ('cmd_test_script', [], 'bzrlib.cmd_test_script'),
6225
6239
        ]:
6226
6240
        builtin_command_registry.register_lazy(name, aliases, module_name)