[PATCH 4 of 4] hgweb: make hgweb filelog output consistent with command line one

Augie Fackler raf at durin42.com
Sat Nov 16 14:51:35 CST 2013


On Sun, Nov 10, 2013 at 06:25:24PM +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <alexander at plav.in>
> # Date 1384093449 -14400
> #      Sun Nov 10 18:24:09 2013 +0400
> # Node ID b0f4c5d5f5fd0153f203e9bacf58aac84abc66f2
> # Parent  3e5ee03883a959fdfc4b4e9b10437c5d3bdcc74a
> hgweb: make hgweb filelog output consistent with command line one

Queued 1-3. marmoute and I feel like this patch is working around a
bug in linkrev handling that would be more correctly fixed at a lower
level so it'll fix blame too.

>
> Before this the hgweb filelog showed changesets with obsolescence markers.
>
> diff -r 3e5ee03883a9 -r b0f4c5d5f5fd mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py	Sun Nov 10 18:23:29 2013 +0400
> +++ b/mercurial/hgweb/webcommands.py	Sun Nov 10 18:24:09 2013 +0400
> @@ -833,37 +833,39 @@
>      morevars['revcount'] = revcount * 2
>
>      count = fctx.filerev() + 1
> -    start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
> -    end = min(count, start + revcount) # last rev on this page
> -    parity = paritygen(web.stripecount, offset=start - end)
> +    end = fctx.filerev() # last rev on this page
> +    parity = paritygen(web.stripecount)
>
>      def entries():
> -        l = []
> +        repo = web.repo
> +        revs = fctx.filelog().revs(end, 0)
> +        curcount = 0
>
> -        repo = web.repo
> -        revs = fctx.filelog().revs(start, end - 1)
>          for i in revs:
>              iterfctx = fctx.filectx(i)
> +            if iterfctx.rev() not in repo:
> +                continue
>
> -            l.append({"parity": parity.next(),
> -                      "filerev": i,
> -                      "file": f,
> -                      "node": iterfctx.hex(),
> -                      "author": iterfctx.user(),
> -                      "date": iterfctx.date(),
> -                      "rename": webutil.renamelink(iterfctx),
> -                      "parent": webutil.parents(iterfctx),
> -                      "child": webutil.children(iterfctx),
> -                      "desc": iterfctx.description(),
> -                      "extra": iterfctx.extra(),
> -                      "tags": webutil.nodetagsdict(repo, iterfctx.node()),
> -                      "bookmarks": webutil.nodebookmarksdict(
> -                          repo, iterfctx.node()),
> -                      "branch": webutil.nodebranchnodefault(iterfctx),
> -                      "inbranch": webutil.nodeinbranch(repo, iterfctx),
> -                      "branches": webutil.nodebranchdict(repo, iterfctx)})
> -        for e in reversed(l):
> -            yield e
> +            curcount += 1
> +            if curcount > revcount:
> +                break
> +            yield {"parity": parity.next(),
> +                   "filerev": i,
> +                   "file": f,
> +                   "node": iterfctx.hex(),
> +                   "author": iterfctx.user(),
> +                   "date": iterfctx.date(),
> +                   "rename": webutil.renamelink(iterfctx),
> +                   "parent": webutil.parents(iterfctx),
> +                   "child": webutil.children(iterfctx),
> +                   "desc": iterfctx.description(),
> +                   "extra": iterfctx.extra(),
> +                   "tags": webutil.nodetagsdict(repo, iterfctx.node()),
> +                   "bookmarks": webutil.nodebookmarksdict(
> +                       repo, iterfctx.node()),
> +                   "branch": webutil.nodebranchnodefault(iterfctx),
> +                   "inbranch": webutil.nodeinbranch(repo, iterfctx),
> +                   "branches": webutil.nodebranchdict(repo, iterfctx)}
>
>      entries = list(entries())
>      latestentry = entries[:1]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list