/bzr-feed

To download this project, use:
bzr branch http://golem.ph.utexas.edu/~distler/code/bzr-feed/

« back to all changes in this revision

Viewing changes to bzr-feed.py

  • Committer: Sam Ruby
  • Date: 2007-03-14 11:51:45 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: rubys@intertwingly.net-20070314115145-e667e1efdf92569b
Cosmetic improvements
* first line of message is title, rest goes into content
* line breaks converted into <br/>
* hypertext link to the modified files

Show diffs side-by-side

added added

removed removed

47
47
        if not len(files): return
48
48
        print "      <dt>" + self._e(label) + ":</dt><dd><ul>"
49
49
        for item in files:
50
 
             path, fid, kind = item[:3]
 
50
             if label == 'Renamed':
 
51
                 display_path, path, fid, kind = item[:4]
 
52
             else:
 
53
                 path, fid, kind = item[:3]
 
54
                 display_path = path
 
55
 
51
56
             if kind == 'directory':
52
57
                 path += '/'
 
58
                 display_path += '/'
53
59
             elif kind == 'symlink':
54
 
                 path += '@'
 
60
                 display_path += '@'
55
61
             if len(item) == 5 and item[4]:
56
 
                 path += '*'
57
 
             print "        <li>" + self._e(path) + "</li>"
 
62
                 display_path += '*'
 
63
 
 
64
             if label == 'Removed':
 
65
                 print "        <li>" + self._e(display_path) + "</li>"
 
66
             else:
 
67
                 print "        <li><a href='%s/%s'>%s</a></li>" % (self.baseuri, self._e(path), self._e(display_path))
 
68
 
58
69
        print "      </ul></dd>"
59
70
 
60
71
    def show(self, revno, rev, delta):
61
72
        revno = str(revno)
 
73
        message = rev.message.rstrip().split('\n')
62
74
 
63
75
        print
64
76
        print "  <entry>"
65
77
        print "    <author>"
66
78
        print "      <name>" + self._e(rev.committer.split("<")[0].rstrip()) + "</name>"
67
79
        print "    </author>"
68
 
        print "    <title>Revision " + self._e(revno) + ": " + self._e(rev.message.rstrip()) + "</title>"
 
80
        print "    <title>Revision " + self._e(revno) + ": " + self._e(message[0]) + "</title>"
69
81
        print "    <link href='" + self._e(self.baseuri + "/#" + revno) + "'/>"
70
82
        if bzr_rev.match(rev.revision_id):
71
83
            print "    <id>" + self._e(bzr_rev.sub(r"tag:\1,\2-\3-\4:\5:\6:\7-\8",rev.revision_id)) + "</id>"
73
85
            print "    <id>" + self._e(self.feedid + ":" + revno) + "</id>"
74
86
        print "    <updated>" + self._e(time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(rev.timestamp))) + "</updated>"
75
87
        print "    <content type='xhtml'><div xmlns='http://www.w3.org/1999/xhtml'>"
76
 
        print "    <p>" + self._e(rev.message.rstrip()) + "</p>"
 
88
        if message[1:]:
 
89
            print "    <p>" + "<br/>\n".join(map(self._e, message[1:])) + "</p>"
77
90
        print "    <dl>"
78
91
        self.show_files(delta.added, "Added")
79
 
        self.show_files(delta.removed, "Remove")
 
92
        self.show_files(delta.removed, "Removed")
80
93
        self.show_files(delta.renamed, "Renamed")
81
94
        self.show_files(delta.modified, "Modified")
82
95
        print "    </dl></div></content>"