[PATCH 2 of 7 V5] hgweb: add a "patch" query parameter to filelog command

Yuya Nishihara yuya at tcha.org
Thu Mar 30 11:37:22 EDT 2017


On Thu, 30 Mar 2017 17:10:28 +0200, Denis Laxalde wrote:
> Yuya Nishihara a écrit :
> > On Sat, 25 Mar 2017 10:20:57 +0100, Denis Laxalde wrote:
> >> # HG changeset patch
> >> # User Denis Laxalde <denis.laxalde at logilab.fr>
> >> # Date 1489398073 -3600
> >> #      Mon Mar 13 10:41:13 2017 +0100
> >> # Node ID a7b9bc1af8b81c332cf34960f581359e6942ca17
> >> # Parent  ffd1a15d456342caba744f5049b97862fcb697c7
> >> # Available At https://hg.logilab.org/users/dlaxalde/hg
> >> #              hg pull https://hg.logilab.org/users/dlaxalde/hg -r a7b9bc1af8b8
> >> # EXP-Topic linerange-log/hgweb-filelog
> >> hgweb: add a "patch" query parameter to filelog command
> >
> >> @@ -981,12 +985,27 @@ def filelog(web, req, tmpl):
> >>      repo = web.repo
> >>      revs = fctx.filelog().revs(start, end - 1)
> >>      entries = []
> >> +
> >> +    diffstyle = web.config('web', 'style', 'paper')
> >> +    if 'style' in req.form:
> >> +        diffstyle = req.form['style'][0]
> >> +
> >> +    def diff(fctx):
> >> +        ctx = fctx.changectx()
> >> +        basectx = ctx.p1()
> >> +        path = fctx.path()
> >> +        return webutil.diffs(web, tmpl, ctx, basectx, [path], diffstyle)
> >> +
> >>      for i in revs:
> >>          iterfctx = fctx.filectx(i)
> >> +        diffs = None
> >> +        if patch:
> >> +            diffs = diff(iterfctx)
> >
> > Got an exception at hidden revision '5cb3b7d1f50f' which had been rebased (in
> > my local repo.) Perhaps linkrev wouldn't be adjusted because we walk revision
> > numbers, not a history of filelog.
> >
> 
> Maybe hidden revisions shouldn't be listed at all? I mean, without the
> "patch" query parameter, you don't get a crash on the /log/<rev>/<file> 
> view,
> but a 404 when following a link pointing to a hidden revision in the
> table, so these log entries are arguably not very useful.

Hidden revisions aren't listed. I suspect fctx.changectx() would return
a hidden changectx because fctx wasn't traversed from a visible parent and
bypassed linkrev adjustment.


More information about the Mercurial-devel mailing list