bug 1336090, wrap webutil.commonentry to add push metadata, r?gps
Previously, we wrapped both changelistentry and changesetentry,
which makes searches on the web not get pushlog data, as that's
using commonentry directly.
As both changelistentry and changesetentry base off of commonentry,
let's just wrap that.
commonentry was introduced in hg in https://www.mercurial-scm.org/repo/hg/diff/5aa2afb4f81a/mercurial/hgweb/webutil.py.
MozReview-Commit-ID: 22G9ls2zd2O
--- a/hgext/pushlog/__init__.py
+++ b/hgext/pushlog/__init__.py
@@ -165,27 +165,20 @@ def addpushmetadata(repo, ctx, d):
if push:
d['pushid'] = push.pushid
d['pushuser'] = push.user
d['pushdate'] = util.makedate(push.when)
d['pushnodes'] = push.nodes
d['pushhead'] = push.nodes[-1]
-def changesetentry(orig, web, req, tmpl, ctx):
- """Wraps webutil.changesetentry to provide pushlog metadata to template."""
- d = orig(web, req, tmpl, ctx)
- addpushmetadata(web.repo, ctx, d)
- return d
-
-
-def changelistentry(orig, web, ctx, tmpl):
- """Wraps webutil.changelistentry to provide pushlog metadata to template."""
- d = orig(web, ctx, tmpl)
- addpushmetadata(web.repo, ctx, d)
+def commonentry(orig, repo, ctx):
+ """Wraps webutil.commonentry to provide pushlog metadata to templates."""
+ d = orig(repo, ctx)
+ addpushmetadata(repo, ctx, d)
return d
Push = collections.namedtuple('Push', ('pushid', 'user', 'when', 'nodes'))
class pushlog(object):
'''An interface to pushlog data.'''
@@ -751,18 +744,17 @@ def extsetup(ui):
}
templatekw.keywords.update(keywords)
# dockeywords was removed in Mercurial 3.6.
if hasattr(templatekw, 'dockeywords'):
templatekw.dockeywords.update(keywords)
- extensions.wrapfunction(webutil, 'changesetentry', changesetentry)
- extensions.wrapfunction(webutil, 'changelistentry', changelistentry)
+ extensions.wrapfunction(webutil, 'commonentry', commonentry)
def reposetup(ui, repo):
if not repo.local():
return
ui.setconfig('hooks', 'pretxnchangegroup.pushlog', pretxnchangegrouphook, 'pushlog')