20
20
from __future__ import absolute_import
22
from bzrlib.lazy_import import lazy_import
23
lazy_import(globals(), """
24
22
from bzrlib import (
28
26
revision as _mod_revision,
31
28
from bzrlib.commands import Command
32
29
from bzrlib.option import Option
33
30
from bzrlib.i18n import gettext, ngettext
35
33
class cmd_sign_my_commits(Command):
36
34
__doc__ = """Sign all commits by a given committer.
86
84
# We have a revision without a signature who has a
87
85
# matching committer, start signing
86
self.outf.write("%s\n" % rev_id)
91
89
repo.sign_revision(rev_id, gpg_strategy)
96
94
repo.commit_write_group()
99
print 'Signed %d revisions' % (count,)
98
ngettext('Signed %d revision.\n', 'Signed %d revisions.\n', count) %
102
102
class cmd_verify_signatures(Command):
151
152
#all revisions by default including merges
152
153
graph = repo.get_graph()
155
155
for rev_id, parents in graph.iter_ancestry(
156
156
[branch.last_revision()]):
157
157
if _mod_revision.is_null(rev_id):
162
162
revisions.append(rev_id)
164
163
count, result, all_verifiable =\
165
gpg_strategy.do_verifications(revisions, repo)
164
gpg.bulk_verify_signatures(repo, revisions, gpg_strategy)
166
165
if all_verifiable:
168
"All commits signed with verifiable keys"))
166
write(gettext("All commits signed with verifiable keys"))
170
write(gpg_strategy.verbose_valid_message(result))
168
write(gpg.verbose_valid_message(result))
173
write(gpg_strategy.valid_commits_message(count))
175
for message in gpg_strategy.verbose_valid_message(result):
176
write_verbose(message)
177
write(gpg_strategy.expired_commit_message(count))
179
for message in gpg_strategy.verbose_expired_key_message(result,
181
write_verbose(message)
182
write(gpg_strategy.unknown_key_message(count))
184
for message in gpg_strategy.verbose_missing_key_message(result):
171
write(gpg.valid_commits_message(count))
173
for message in gpg.verbose_valid_message(result):
174
write_verbose(message)
175
write(gpg.expired_commit_message(count))
177
for message in gpg.verbose_expired_key_message(result, repo):
178
write_verbose(message)
179
write(gpg.unknown_key_message(count))
181
for message in gpg.verbose_missing_key_message(result):
185
182
write_verbose(message)
186
write(gpg_strategy.commit_not_valid_message(count))
183
write(gpg.commit_not_valid_message(count))
188
for message in gpg_strategy.verbose_not_valid_message(result,
185
for message in gpg.verbose_not_valid_message(result, repo):
190
186
write_verbose(message)
191
write(gpg_strategy.commit_not_signed_message(count))
187
write(gpg.commit_not_signed_message(count))
193
for message in gpg_strategy.verbose_not_signed_message(result,
189
for message in gpg.verbose_not_signed_message(result, repo):
195
190
write_verbose(message)