121
119
return (count, result, all_verifiable)
123
121
def valid_commits_message(self, count):
124
return i18n.gettext(u"{0} commits with valid signatures").format(
122
return i18n.gettext("{0} commits with valid signatures").format(
125
123
count[SIGNATURE_VALID])
127
125
def unknown_key_message(self, count):
128
return i18n.ngettext(u"{0} commit with unknown key",
129
u"{0} commits with unknown keys",
126
return i18n.ngettext("{0} commit with unknown key",
127
"{0} commits with unknown keys",
130
128
count[SIGNATURE_KEY_MISSING]).format(
131
129
count[SIGNATURE_KEY_MISSING])
133
131
def commit_not_valid_message(self, count):
134
return i18n.ngettext(u"{0} commit not valid",
135
u"{0} commits not valid",
132
return i18n.ngettext("{0} commit not valid",
133
"{0} commits not valid",
136
134
count[SIGNATURE_NOT_VALID]).format(
137
135
count[SIGNATURE_NOT_VALID])
139
137
def commit_not_signed_message(self, count):
140
return i18n.ngettext(u"{0} commit not signed",
141
u"{0} commits not signed",
138
return i18n.ngettext("{0} commit not signed",
139
"{0} commits not signed",
142
140
count[SIGNATURE_NOT_SIGNED]).format(
143
141
count[SIGNATURE_NOT_SIGNED])
177
170
def _command_line(self):
179
return [self._config.gpg_signing_command(), '--clearsign', '-u',
180
self._config.gpg_signing_key()]
171
return [self._config.gpg_signing_command(), '--clearsign']
182
173
def __init__(self, config):
183
174
self._config = config
283
274
if isinstance(acceptable_keys_config, unicode):
284
275
acceptable_keys_config = str(acceptable_keys_config)
285
276
except UnicodeEncodeError:
286
#gpg Context.keylist(pattern) does not like unicode
287
277
raise errors.BzrCommandError('Only ASCII permitted in option names')
289
279
if acceptable_keys_config is not None:
306
296
"No GnuPG key results for pattern: {}"
307
297
).format(pattern))
309
def do_verifications(self, revisions, repository,
310
process_events_callback=None):
299
def do_verifications(self, revisions, repository):
311
300
"""do verifications on a set of revisions
313
302
:param revisions: list of revision ids to verify
314
303
:param repository: repository object
315
:param process_events_callback: method to call for GUI frontends that
316
want to keep their UI refreshed
318
305
:return: count dictionary of results of each type,
319
306
result list for each revision,
332
319
count[verification_result] += 1
333
320
if verification_result != SIGNATURE_VALID:
334
321
all_verifiable = False
335
if process_events_callback is not None:
336
process_events_callback()
337
322
return (count, result, all_verifiable)
339
324
def verbose_valid_message(self, result):
345
330
signers[uid] += 1
347
332
for uid, number in signers.items():
348
result.append( i18n.ngettext(u"{0} signed {1} commit",
349
u"{0} signed {1} commits",
333
result.append( i18n.ngettext("{0} signed {1} commit",
334
"{0} signed {1} commits",
350
335
number).format(uid, number) )
362
347
signers[authors] += 1
364
349
for authors, number in signers.items():
365
result.append( i18n.ngettext(u"{0} commit by author {1}",
366
u"{0} commits by author {1}",
350
result.append( i18n.ngettext("{0} commit by author {1}",
351
"{0} commits by author {1}",
367
352
number).format(number, authors) )
378
363
signers[authors] += 1
380
365
for authors, number in signers.items():
381
result.append( i18n.ngettext(u"{0} commit by author {1}",
382
u"{0} commits by author {1}",
366
result.append( i18n.ngettext("{0} commit by author {1}",
367
"{0} commits by author {1}",
383
368
number).format(number, authors) )
392
377
signers[fingerprint] += 1
394
379
for fingerprint, number in signers.items():
395
result.append( i18n.ngettext(u"Unknown key {0} signed {1} commit",
396
u"Unknown key {0} signed {1} commits",
380
result.append( i18n.ngettext("Unknown key {0} signed {1} commit",
381
"Unknown key {0} signed {1} commits",
397
382
number).format(fingerprint, number) )
400
385
def valid_commits_message(self, count):
401
386
"""returns message for number of commits"""
402
return i18n.gettext(u"{0} commits with valid signatures").format(
387
return i18n.gettext("{0} commits with valid signatures").format(
403
388
count[SIGNATURE_VALID])
405
390
def unknown_key_message(self, count):
406
391
"""returns message for number of commits"""
407
return i18n.ngettext(u"{0} commit with unknown key",
408
u"{0} commits with unknown keys",
392
return i18n.ngettext("{0} commit with unknown key",
393
"{0} commits with unknown keys",
409
394
count[SIGNATURE_KEY_MISSING]).format(
410
395
count[SIGNATURE_KEY_MISSING])
412
397
def commit_not_valid_message(self, count):
413
398
"""returns message for number of commits"""
414
return i18n.ngettext(u"{0} commit not valid",
415
u"{0} commits not valid",
399
return i18n.ngettext("{0} commit not valid",
400
"{0} commits not valid",
416
401
count[SIGNATURE_NOT_VALID]).format(
417
402
count[SIGNATURE_NOT_VALID])
419
404
def commit_not_signed_message(self, count):
420
405
"""returns message for number of commits"""
421
return i18n.ngettext(u"{0} commit not signed",
422
u"{0} commits not signed",
406
return i18n.ngettext("{0} commit not signed",
407
"{0} commits not signed",
423
408
count[SIGNATURE_NOT_SIGNED]).format(
424
409
count[SIGNATURE_NOT_SIGNED])