20
20
from __future__ import absolute_import
22
from bzrlib.lazy_import import lazy_import
23
lazy_import(globals(), """
22
24
from bzrlib import (
26
28
revision as _mod_revision,
28
31
from bzrlib.commands import Command
29
32
from bzrlib.option import Option
30
33
from bzrlib.i18n import gettext, ngettext
33
35
class cmd_sign_my_commits(Command):
34
36
__doc__ = """Sign all commits by a given committer.
84
86
# We have a revision without a signature who has a
85
87
# matching committer, start signing
86
self.outf.write("%s\n" % rev_id)
89
91
repo.sign_revision(rev_id, gpg_strategy)
94
96
repo.commit_write_group()
98
ngettext('Signed %d revision.\n', 'Signed %d revisions.\n', count) %
99
print 'Signed %d revisions' % (count,)
102
102
class cmd_verify_signatures(Command):
152
151
#all revisions by default including merges
153
152
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)
163
164
count, result, all_verifiable =\
164
gpg.bulk_verify_signatures(repo, revisions, gpg_strategy)
165
gpg_strategy.do_verifications(revisions, repo)
165
166
if all_verifiable:
166
write(gettext("All commits signed with verifiable keys"))
168
"All commits signed with verifiable keys"))
168
write(gpg.verbose_valid_message(result))
170
write(gpg_strategy.verbose_valid_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):
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):
182
185
write_verbose(message)
183
write(gpg.commit_not_valid_message(count))
186
write(gpg_strategy.commit_not_valid_message(count))
185
for message in gpg.verbose_not_valid_message(result, repo):
188
for message in gpg_strategy.verbose_not_valid_message(result,
186
190
write_verbose(message)
187
write(gpg.commit_not_signed_message(count))
191
write(gpg_strategy.commit_not_signed_message(count))
189
for message in gpg.verbose_not_signed_message(result, repo):
193
for message in gpg_strategy.verbose_not_signed_message(result,
190
195
write_verbose(message)