Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 39800:be0f32ca2671
hgweb: use heads() instead of headrevs()
These appear to be the only callers of headrevs() on file storage
objects. Let's port to heads() so we can remove headrevs().
Differential Revision: https://phab.mercurial-scm.org/D4662
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 18 Sep 2018 19:00:17 -0700 |
parents | 6268fed317d0 |
children | 536f22d6c2c5 |
comparison
equal
deleted
inserted
replaced
39799:76f92d208f7a | 39800:be0f32ca2671 |
---|---|
141 | 141 |
142 def _filerevision(web, fctx): | 142 def _filerevision(web, fctx): |
143 f = fctx.path() | 143 f = fctx.path() |
144 text = fctx.data() | 144 text = fctx.data() |
145 parity = paritygen(web.stripecount) | 145 parity = paritygen(web.stripecount) |
146 ishead = fctx.filerev() in fctx.filelog().headrevs() | 146 ishead = fctx.filenode() in fctx.filelog().heads() |
147 | 147 |
148 if stringutil.binary(text): | 148 if stringutil.binary(text): |
149 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' | 149 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' |
150 text = '(binary:%s)' % mt | 150 text = '(binary:%s)' % mt |
151 | 151 |
920 The ``fileannotate`` template is rendered. | 920 The ``fileannotate`` template is rendered. |
921 """ | 921 """ |
922 fctx = webutil.filectx(web.repo, web.req) | 922 fctx = webutil.filectx(web.repo, web.req) |
923 f = fctx.path() | 923 f = fctx.path() |
924 parity = paritygen(web.stripecount) | 924 parity = paritygen(web.stripecount) |
925 ishead = fctx.filerev() in fctx.filelog().headrevs() | 925 ishead = fctx.filenode() in fctx.filelog().heads() |
926 | 926 |
927 # parents() is called once per line and several lines likely belong to | 927 # parents() is called once per line and several lines likely belong to |
928 # same revision. So it is worth caching. | 928 # same revision. So it is worth caching. |
929 # TODO there are still redundant operations within basefilectx.parents() | 929 # TODO there are still redundant operations within basefilectx.parents() |
930 # and from the fctx.annotate() call itself that could be cached. | 930 # and from the fctx.annotate() call itself that could be cached. |