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
--- 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')