pushlog: change arguments to pushes_worker (bug 1286426); r=glandium
authorGregory Szorc <gps@mozilla.com>
Thu, 14 Jul 2016 10:40:54 -0700
changeset 8962 6b1312dc6c6727879bb6bd5bc3d6c68756a0f4b7
parent 8961 5d87802927e17c50695963c12d48a0db64a384ae
child 8963 8db703bd97e8bb41f9bf053c750b4e0c605151b3
push id1034
push userbmo:gps@mozilla.com
push dateTue, 19 Jul 2016 18:10:24 +0000
reviewersglandium
bugs1286426
pushlog: change arguments to pushes_worker (bug 1286426); r=glandium The old behavior of relying on web being defined to populate full metadata was a bit wonky. Change to use explicit "repo" and "full" arguments. Passing "repo" is also necessary so a future commit can ignore filtered changesets. MozReview-Commit-ID: HZVISfDrpxR
hgext/pushlog-legacy/pushlog-feed.py
--- a/hgext/pushlog-legacy/pushlog-feed.py
+++ b/hgext/pushlog-legacy/pushlog-feed.py
@@ -457,24 +457,24 @@ def pushlogHTML(web, req, tmpl):
                 rev=0,
                 entries=lambda **x: changelist(limit=0,**x),
                 latestentry=lambda **x: changelist(limit=1,**x),
                 startdate='startdate' in req.form and req.form['startdate'][0] or '1 week ago',
                 enddate='enddate' in req.form and req.form['enddate'][0] or 'now',
                 querydescription=query.description(),
                 archives=web.archivelist("tip"))
 
-def pushes_worker(query, web = None):
+def pushes_worker(query, repo, full):
     """Given a PushlogQuery, return a data structure mapping push IDs
     to a map of data about the push."""
     pushes = {}
     for id, user, date, node in query.entries:
         id = str(id)
-        if web:
-            ctx = web.repo[node]
+        if full:
+            ctx = repo[node]
             n = ctx.node()
             node = {"node": hex(n),
                     "author": ctx.user(),
                     "desc": ctx.description(),
                     "branch": ctx.branch(),
                     "parents": [c.hex() for c in ctx.parents()],
                     "tags": ctx.tags(),
                     "files": ctx.files()
@@ -487,18 +487,17 @@ def pushes_worker(query, web = None):
                           'date': date,
                           'changesets': [node]}
 
     return {'pushes': pushes, 'lastpushid': query.lastpushid}
 
 def pushes(web, req, tmpl):
     """WebCommand to return a data structure containing pushes."""
     query = pushlogSetup(web.repo, req)
-
-    data = pushes_worker(query, 'full' in req.form and web)
+    data = pushes_worker(query, web.repo, 'full' in req.form)
 
     if query.formatversion == 1:
         return tmpl('pushes1', **data)
     elif query.formatversion == 2:
         return tmpl('pushes2', **data)
 
     raise ErrorResponse(500, 'unexpected formatversion')