rework pushlog output to group pushes better
authorTed Mielczarek <ted.mielczarek@gmail.com>
Thu, 17 Jul 2008 15:17:45 -0400
changeset 30 141f44a7f8be15b1cf5922dd827beccbff0cc6ed
parent 29 d4bf9acf19591888bd670000ee1424ff374d116f
child 31 c8b39f9d6c14b74fd9b82b0e757ab1ace7b8bc71
push id8
push usertmielczarek@mozilla.com
push dateMon, 21 Jul 2008 19:37:17 +0000
rework pushlog output to group pushes better
pushlog-feed.py
--- a/pushlog-feed.py
+++ b/pushlog-feed.py
@@ -53,16 +53,17 @@ def pushlogSetup(web, req):
         reponame = os.path.basename(os.path.dirname(repopath))
     pushdb = os.path.join(web.repo.path, "pushlog2.db")
     conn = sqlite.connect(pushdb)
 
     if 'node' in req.form:
         start = int(req.form['node'][0])
     else:
         start = 0
+
     e = getpushlogentries(conn, start * PUSHES_PER_PAGE, 10)
     total = gettotalpushlogentries(conn)
     proto = req.env.get('wsgi.url_scheme')
     if proto == 'https':
         proto = 'https'
         default_port = "443"
     else:
         proto = 'http'
@@ -147,39 +148,40 @@ def pushlogHTML(web, req, tmpl):
         if page != numpages - 1:
             nav.append({'page': page + 1, 'label': "Next"})
             nav.append({'page': numpages - 1, 'label': "Last"})
         return nav
     
     def changelist(limit=0, **map):
         allentries = []
         lastid = None
-        lastparity = 0
+        ch = None
         l = []
         for id, user, date, node in entries:
+            if id != lastid:
+                lastid = id
+                l.append({"parity": parity.next(),
+                          "user": user,
+                          "date": (date, 0),
+                          'numchanges': 0,
+                          "changes": []})
+                ch = l[-1]['changes']
             ctx = web.repo.changectx(node)
-            if id == lastid:
-                p = lastparity
-            else:
-                p = parity.next()
-                lastparity = p
-                lastid = id
             n = ctx.node()
-            l.append({"parity": p,
-                      "author": user,
-                      "desc": ctx.description(),
-                      "date": (date, 0),
-                      "files": web.listfilediffs(tmpl, ctx.files(), n),
-                      "rev": ctx.rev(),
-                      "node": hex(n),
-                      "tags": nodetagsdict(web.repo, n),
-                      "branches": nodebranchdict(web.repo, ctx),
-                      "inbranch": nodeinbranch(web.repo, ctx)
-                      })
-
+            ch.append({"author": ctx.user(),
+                       "desc": ctx.description(),
+                       "files": web.listfilediffs(tmpl, ctx.files(), n),
+                       "rev": ctx.rev(),
+                       "node": hex(n),
+                       "tags": nodetagsdict(web.repo, n),
+                       "branches": nodebranchdict(web.repo, ctx),
+                       "inbranch": nodeinbranch(web.repo, ctx),
+                       "parity": l[-1]["parity"]
+                       })
+            l[-1]['numchanges'] += 1
 
         if limit > 0:
             l = l[:limit]
 
         for e in l:
             yield e
 
     parity = paritygen(web.stripecount)