Add changed files to the pushlog feed.
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Wed, 13 Aug 2008 21:04:52 +0200
changeset 41 b582a89089e0315fc81c04c80dbd0d121e3520a3
parent 40 ef3a130e1e1487f57d2b4c17ead34830fb702b55
child 42 1650131bc37ee2996843a0e46a79e77d4192562c
push id15
push usertmielczarek@mozilla.com
push dateWed, 13 Aug 2008 19:07:41 +0000
Add changed files to the pushlog feed.
pushlog-feed.py
--- a/pushlog-feed.py
+++ b/pushlog-feed.py
@@ -156,42 +156,50 @@ def pushlogSetup(web, req):
     port = req.env["SERVER_PORT"]
     port = port != default_port and (":" + port) or ""
 
     urlbase = '%s://%s%s' % (proto, req.env['SERVER_NAME'], port)
     return (e, urlbase, reponame, total, page, dates)
     
 def pushlogFeed(web, req):
     (e, urlbase, reponame, total, page, dates) = pushlogSetup(web, req)
+    isotime = lambda x: datetime.utcfromtimestamp(x).isoformat() + 'Z'
 
     resp = ["""<?xml version="1.0" encoding="UTF-8"?>
 <feed xmlns="http://www.w3.org/2005/Atom">
  <id>%(urlbase)s%(url)spushlog</id>
  <link rel="self" href="%(urlbase)s%(url)spushlog" />
  <updated>%(date)s</updated>
  <title>%(reponame)s Pushlog</title>""" % {'urlbase': urlbase,
                               'url': req.url,
                               'reponame': reponame,
-                              'date': e[0][2]}];
+                              'date': isotime(e[0][2])}];
 
     for id, user, date, node in e:
+        ctx = web.repo.changectx(node)
         resp.append("""
  <entry>
   <title>Changeset %(node)s</title>
   <id>http://www.selenic.com/mercurial/#changeset-%(node)s</id>
   <link href="%(urlbase)s%(url)srev/%(node)s" />
   <updated>%(date)s</updated>
   <author>
    <name>%(user)s</name>
   </author>
+  <content type="xhtml">
+    <div xmlns="http://www.w3.org/1999/xhtml">
+      <ul class="filelist"><li class="file">%(files)s</li></ul>
+    </div>
+  </content>
  </entry>""" % {'node': node,
-                'date': datetime.utcfromtimestamp(date).isoformat()+"Z",
+                'date': isotime(date),
                 'user': xmlescape(user),
                 'urlbase': urlbase,
-                'url': req.url})
+                'url': req.url,
+                'files': '</li><li>'.join(ctx.files())})
 
     resp.append("</feed>")
 
     resp = "".join(resp)
 
     req.respond(HTTP_OK, ATOM_MIMETYPE, length=len(resp))
     req.write(resp)