~0x44/nova/bug838466

« back to all changes in this revision

Viewing changes to bzrplugins/novalog/__init__.py

  • Committer: Eric Day
  • Date: 2010-10-21 18:49:51 UTC
  • mto: This revision was merged to the branch mainline in revision 377.
  • Revision ID: eday@oddments.org-20101021184951-x0vs3s8y7mc0aeyy
PEP8 and pylint cleanup. There should be no functional changes here, just style changes to get violations down.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import bzrlib.log
18
18
from bzrlib.osutils import format_date
19
19
 
20
 
#
21
 
# This is mostly stolen from bzrlib.log.GnuChangelogLogFormatter
22
 
# The difference is that it logs the author rather than the committer
23
 
# which for Nova always is Tarmac.
24
 
#
 
20
 
25
21
class NovaLogFormat(bzrlib.log.GnuChangelogLogFormatter):
 
22
    """This is mostly stolen from bzrlib.log.GnuChangelogLogFormatter
 
23
    The difference is that it logs the author rather than the committer
 
24
    which for Nova always is Tarmac."""
 
25
 
26
26
    preferred_levels = 1
 
27
 
27
28
    def log_revision(self, revision):
28
29
        """Log a revision, either merged or not."""
29
30
        to_file = self.to_file
38
39
        to_file.write('%s  %s\n\n' % (date_str, ", ".join(authors)))
39
40
 
40
41
        if revision.delta is not None and revision.delta.has_changed():
41
 
            for c in revision.delta.added + revision.delta.removed + revision.delta.modified:
 
42
            for c in revision.delta.added + revision.delta.removed + \
 
43
                     revision.delta.modified:
42
44
                path, = c[:1]
43
45
                to_file.write('\t* %s:\n' % (path,))
44
46
            for c in revision.delta.renamed:
45
 
                oldpath,newpath = c[:2]
 
47
                oldpath, newpath = c[:2]
46
48
                # For renamed files, show both the old and the new path
47
 
                to_file.write('\t* %s:\n\t* %s:\n' % (oldpath,newpath))
 
49
                to_file.write('\t* %s:\n\t* %s:\n' % (oldpath, newpath))
48
50
            to_file.write('\n')
49
51
 
50
52
        if not revision.rev.message:
56
58
            to_file.write('\n')
57
59
 
58
60
bzrlib.log.register_formatter('novalog', NovaLogFormat)
59