From 9939f03d8e54bbb9e847f2cb8b10c0deb06a48cb Mon Sep 17 00:00:00 2001 From: David Soria Parra Date: Mon, 12 Feb 2018 15:58:42 -0800 Subject: [PATCH] hg: make file view in hgweb working Summary: hgweb's file view must determine if the displayed file revision is the head of the filelog graph. As remotefilelog does not implement file revision, we have to check if headrevs is implemented. Reviewed By: DurhamG Differential Revision: D6954143 fbshipit-source-id: 0657e58110112537dc5baadf743c657d4ecf372a --- mercurial/hgweb/webcommands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py index 782581416f..084fd6acab 100644 --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -135,7 +135,9 @@ def _filerevision(web, req, tmpl, fctx): f = fctx.path() text = fctx.data() parity = paritygen(web.stripecount) - ishead = fctx.filerev() in fctx.filelog().headrevs() + ishead = False + if util.safehasattr(fctx.filelog(), 'headrevs'): + ishead = fctx.filerev() in fctx.filelog().headrevs() if util.binary(text): mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' @@ -879,7 +881,9 @@ def annotate(web, req, tmpl): fctx = webutil.filectx(web.repo, req) f = fctx.path() parity = paritygen(web.stripecount) - ishead = fctx.filerev() in fctx.filelog().headrevs() + ishead = False + if util.safehasattr(fctx.filelog(), 'headrevs'): + ishead = fctx.filerev() in fctx.filelog().headrevs() # parents() is called once per line and several lines likely belong to # same revision. So it is worth caching.