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