# HG changeset patch # User Matt Mackall <m...@selenic.com> # Date 1474310889 18000 # Mon Sep 19 13:48:09 2016 -0500 # Node ID e6e68432abcbeec0a74478f03762b0b3192c09b5 # Parent 6db1b2e7d19ed317404c1275db46780d40ececb8 extdata: pass contexts to hgweb templates
This makes hgweb more in line with the command line templater, and gives access to the extdata sources. diff -r 6db1b2e7d19e -r e6e68432abcb mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Mon Sep 19 09:16:00 2016 -0500 +++ b/mercurial/hgweb/webutil.py Mon Sep 19 13:48:09 2016 -0500 @@ -325,6 +325,7 @@ 'bookmarks': nodebookmarksdict(repo, node), 'parent': lambda **x: parents(ctx), 'child': lambda **x: children(ctx), + 'ctx': ctx } def changelistentry(web, ctx, tmpl): diff -r 6db1b2e7d19e -r e6e68432abcb tests/test-hgweb-raw.t --- a/tests/test-hgweb-raw.t Mon Sep 19 09:16:00 2016 -0500 +++ b/tests/test-hgweb-raw.t Mon Sep 19 13:48:09 2016 -0500 @@ -55,4 +55,35 @@ $ cat access.log error.log 127.0.0.1 - - [*] "GET /?f=bf0ff59095c9;file=sub/some%20text%25.txt;style=raw HTTP/1.1" 200 - (glob) - $ cd .. +Test extdata support in hgweb + + $ mkdir mystyle + $ echo "__base__ = raw" > mystyle/map + $ echo 'changelogentry = changelog.tmpl' >> mystyle/map + $ echo '{node|short} {if(push, "(pushed by {push})")}' > mystyle/changelog.tmpl + + $ echo "[extdata]" >> .hg/hgrc + $ echo "push = pushlog.txt" >> .hg/hgrc + $ echo "0 bob" > pushlog.txt + + $ rm access.log error.log + $ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid \ + > --config web.guessmime=True -t mystyle + + $ cat hg.pid >> $DAEMON_PIDS + $ (get-with-headers.py localhost:$HGPORT 'changelog' content-type content-length content-disposition) >getoutput.txt + $ killdaemons.py hg.pid + + $ cat getoutput.txt + 200 Script output follows + content-type: text/plain; charset=ascii + + + # HG changelog + # Node ID bf0ff59095c91b192667cfe903dcdba4aced4833 + + bf0ff59095c9 (pushed by bob) + + $ cat access.log error.log + 127.0.0.1 - - [*] "GET /changelog HTTP/1.1" 200 - (glob) + _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel