Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 39794:4f44f747f094
hgweb: use scmutil.binnode() to translate None to wdir hash (issue5988)
I left some of ctx.node() calls unchanged as they seemed unlikely to be
workingctx, or passed to diff functions where None is the default value.
Note that a None revision can also cause a similar problem, but I'm not sure
if we can simply bulk-replace ctx.rev() with scmutil.intrev(ctx) as there's
large hole between tip revision and wdir revision. If such pair were passed
in to xrange() for example, we would waste CPU time.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 23 Sep 2018 16:11:01 +0900 |
parents | 536f22d6c2c5 |
children | 9310037f0636 |
comparison
equal
deleted
inserted
replaced
39793:536f22d6c2c5 | 39794:4f44f747f094 |
---|---|
292 def changelist(context): | 292 def changelist(context): |
293 count = 0 | 293 count = 0 |
294 | 294 |
295 for ctx in searchfunc[0](funcarg): | 295 for ctx in searchfunc[0](funcarg): |
296 count += 1 | 296 count += 1 |
297 n = ctx.node() | 297 n = scmutil.binnode(ctx) |
298 showtags = webutil.showtag(web.repo, 'changelogtag', n) | 298 showtags = webutil.showtag(web.repo, 'changelogtag', n) |
299 files = webutil.listfilediffs(ctx.files(), n, web.maxfiles) | 299 files = webutil.listfilediffs(ctx.files(), n, web.maxfiles) |
300 | 300 |
301 lm = webutil.commonentry(web.repo, ctx) | 301 lm = webutil.commonentry(web.repo, ctx) |
302 lm.update({ | 302 lm.update({ |
519 else: | 519 else: |
520 ctx = web.repo['tip'] | 520 ctx = web.repo['tip'] |
521 symrev = 'tip' | 521 symrev = 'tip' |
522 path = webutil.cleanpath(web.repo, web.req.qsparams.get('file', '')) | 522 path = webutil.cleanpath(web.repo, web.req.qsparams.get('file', '')) |
523 mf = ctx.manifest() | 523 mf = ctx.manifest() |
524 node = ctx.node() | 524 node = scmutil.binnode(ctx) |
525 | 525 |
526 files = {} | 526 files = {} |
527 dirs = {} | 527 dirs = {} |
528 parity = paritygen(web.stripecount) | 528 parity = paritygen(web.stripecount) |
529 | 529 |
866 fctx = None | 866 fctx = None |
867 parent = ctx.p1() | 867 parent = ctx.p1() |
868 leftrev = parent.rev() | 868 leftrev = parent.rev() |
869 leftnode = parent.node() | 869 leftnode = parent.node() |
870 rightrev = ctx.rev() | 870 rightrev = ctx.rev() |
871 rightnode = ctx.node() | 871 rightnode = scmutil.binnode(ctx) |
872 if path in ctx: | 872 if path in ctx: |
873 fctx = ctx[path] | 873 fctx = ctx[path] |
874 rightlines = filelines(fctx) | 874 rightlines = filelines(fctx) |
875 if path not in parent: | 875 if path not in parent: |
876 leftlines = () | 876 leftlines = () |