~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit_signature_commands.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Command which looks for unsigned commits by the current user, and signs them.
18
18
"""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
from bzrlib.lazy_import import lazy_import
23
21
lazy_import(globals(), """
24
22
from bzrlib import (
25
 
    controldir,
 
23
    bzrdir as _mod_bzrdir,
26
24
    errors,
27
25
    gpg,
28
26
    revision as _mod_revision,
53
51
 
54
52
    def run(self, location=None, committer=None, dry_run=False):
55
53
        if location is None:
56
 
            bzrdir = controldir.ControlDir.open_containing('.')[0]
 
54
            bzrdir = _mod_bzrdir.BzrDir.open_containing('.')[0]
57
55
        else:
58
56
            # Passed in locations should be exact
59
 
            bzrdir = controldir.ControlDir.open(location)
 
57
            bzrdir = _mod_bzrdir.BzrDir.open(location)
60
58
        branch = bzrdir.open_branch()
61
59
        repo = branch.repository
62
60
        branch_config = branch.get_config()
63
61
 
64
62
        if committer is None:
65
63
            committer = branch_config.username()
66
 
        gpg_strategy = gpg.GPGStrategy(branch.get_config_stack())
 
64
        gpg_strategy = gpg.GPGStrategy(branch_config)
67
65
 
68
66
        count = 0
69
67
        repo.lock_write()
118
116
 
119
117
    def run(self, acceptable_keys=None, revision=None, verbose=None,
120
118
                                                            location=u'.'):
121
 
        bzrdir = controldir.ControlDir.open_containing(location)[0]
 
119
        bzrdir = _mod_bzrdir.BzrDir.open_containing(location)[0]
122
120
        branch = bzrdir.open_branch()
123
121
        repo = branch.repository
124
 
        branch_config = branch.get_config_stack()
 
122
        branch_config = branch.get_config()
125
123
        gpg_strategy = gpg.GPGStrategy(branch_config)
126
124
 
127
125
        gpg_strategy.set_acceptable_keys(acceptable_keys)
143
141
                if to_revid is None:
144
142
                    to_revno = branch.revno()
145
143
                if from_revno is None or to_revno is None:
146
 
                    raise errors.BzrCommandError(gettext(
147
 
                    'Cannot verify a range of non-revision-history revisions'))
 
144
                    raise errors.BzrCommandError('Cannot verify a range of '\
 
145
                                               'non-revision-history revisions')
148
146
                for revno in range(from_revno, to_revno + 1):
149
147
                    revisions.append(branch.get_rev_id(revno))
150
148
        else:
174
172
            if verbose:
175
173
               for message in gpg_strategy.verbose_valid_message(result):
176
174
                   write_verbose(message)
177
 
            write(gpg_strategy.expired_commit_message(count))
178
 
            if verbose:
179
 
               for message in gpg_strategy.verbose_expired_key_message(result,
180
 
                                                                          repo):
181
 
                   write_verbose(message)
182
175
            write(gpg_strategy.unknown_key_message(count))
183
176
            if verbose:
184
177
                for message in gpg_strategy.verbose_missing_key_message(result):