/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/gpg.py

  • Committer: Jonathan Riddell
  • Date: 2011-06-24 12:16:17 UTC
  • mto: This revision was merged to the branch mainline in revision 6003.
  • Revision ID: jriddell@canonical.com-20110624121617-40fmcusn8zz960s1
fix verbose messages, now return a list

Show diffs side-by-side

added added

removed removed

Lines of Context:
309
309
        return (count, result, all_verifiable)
310
310
 
311
311
    def verbose_valid_message(self, result):
312
 
        """takes a verify result and prints out number of signed commits"""
 
312
        """takes a verify result and returns list of signed commits strings"""
313
313
        signers = {}
314
314
        for rev_id, validity, uid in result:
315
315
            if validity == SIGNATURE_VALID:
316
316
                signers.setdefault(uid, 0)
317
317
                signers[uid] += 1
 
318
        result = []
318
319
        for uid, number in signers.items():
319
 
             return i18n.ngettext("{0} signed {1} commit", 
 
320
             result.append( i18n.ngettext("{0} signed {1} commit", 
320
321
                             "{0} signed {1} commits",
321
 
                             number).format(uid, number)
 
322
                             number).format(uid, number) )
 
323
        return result
322
324
 
323
325
 
324
326
    def verbose_not_valid_message(self, result, repo):
325
 
        """takes a verify result and prints out not signed commit info"""
 
327
        """takes a verify result and returns list of not valid commit info"""
326
328
        signers = {}
327
329
        for rev_id, validity, empty in result:
328
330
            if validity == SIGNATURE_NOT_VALID:
330
332
                authors = ', '.join(revision.get_apparent_authors())
331
333
                signers.setdefault(authors, 0)
332
334
                signers[authors] += 1
 
335
        result = []
333
336
        for authors, number in signers.items():
334
 
            return i18n.ngettext("{0} commit by author {1}", 
 
337
            result.append( i18n.ngettext("{0} commit by author {1}", 
335
338
                                 "{0} commits by author {1}",
336
 
                                 number).format(number, authors)
 
339
                                 number).format(number, authors) )
 
340
        return result
337
341
 
338
342
    def verbose_not_signed_message(self, result, repo):
339
 
        """takes a verify result and prints out not signed commit info"""
 
343
        """takes a verify result and returns list of not signed commit info"""
340
344
        signers = {}
341
345
        for rev_id, validity, empty in result:
342
 
            if validity == SIGNATURE_KEY_MISSING:
 
346
            if validity == SIGNATURE_NOT_SIGNED:
343
347
                revision = repo.get_revision(rev_id)
344
348
                authors = ', '.join(revision.get_apparent_authors())
345
349
                signers.setdefault(authors, 0)
346
350
                signers[authors] += 1
 
351
        result = []
347
352
        for authors, number in signers.items():
348
 
            return i18n.ngettext("{0} commit by author {1}", 
 
353
            result.append( i18n.ngettext("{0} commit by author {1}", 
349
354
                                 "{0} commits by author {1}",
350
 
                                 number).format(number, authors)
 
355
                                 number).format(number, authors) )
 
356
        return result
351
357
 
352
358
    def verbose_missing_key_message(self, result):
353
 
        """takes a verify result and prints out missing key info"""
 
359
        """takes a verify result and returns list of missing key info"""
354
360
        signers = {}
355
361
        for rev_id, validity, fingerprint in result:
356
362
            if validity == SIGNATURE_KEY_MISSING:
357
363
                signers.setdefault(fingerprint, 0)
358
364
                signers[fingerprint] += 1
 
365
        result = []
359
366
        for fingerprint, number in signers.items():
360
 
            return i18n.ngettext("Unknown key {0} signed {1} commit", 
 
367
            result.append( i18n.ngettext("Unknown key {0} signed {1} commit", 
361
368
                                 "Unknown key {0} signed {1} commits",
362
 
                                 number).format(fingerprint, number)
 
369
                                 number).format(fingerprint, number) )
 
370
        return result
363
371
 
364
372
    def valid_commits_message(self, count):
365
373
        """returns message for number of commits"""