Mercurial > hg-stable
view tests/test-log-exthook.t @ 36811:8e1556ac01bb
hgweb: validate WSGI environment dict
The wsgiref.validate module contains useful functions for validating
that various WSGI data structures are proper.
This commit adds validation of the environment dict to our built-in
HTTP server, which turns an HTTP request into an environment dict.
The check discovered that we weren't always setting QUERY_STRING,
which would cause the cgi module to fall back to sys.argv. So we
change things to always set QUERY_STRING.
The check passes on Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D2731
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 08 Mar 2018 09:44:27 -0800 |
parents | c8e2d6ed1f9e |
children | 2b9f315a4217 |
line wrap: on
line source
Test hg log changeset printer external hook ------------------------------------------- $ cat > $TESTTMP/logexthook.py <<EOF > from __future__ import absolute_import > from mercurial import ( > commands, > logcmdutil, > repair, > ) > def rot13description(self, ctx): > summary = "summary".encode('rot13') > description = ctx.description().strip().splitlines()[0].encode('rot13') > self.ui.write("%s: %s\n" % (summary, description)) > def reposetup(ui, repo): > logcmdutil.changesetprinter._exthook = rot13description > EOF Prepare the repository $ hg init empty $ cd empty $ touch ROOT $ hg commit -A -m "Root" ROOT $ touch a b c $ hg commit -A -m "Add A, B, C" a b c Check the log $ hg log --config extensions.t=$TESTTMP/logexthook.py changeset: 1:70fc82b23320 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 fhzznel: Nqq N, O, P summary: Add A, B, C changeset: 0:b00443a54871 user: test date: Thu Jan 01 00:00:00 1970 +0000 fhzznel: Ebbg summary: Root Check that exthook is working with graph log too $ hg log -G --config extensions.t=$TESTTMP/logexthook.py @ changeset: 1:70fc82b23320 | tag: tip | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | fhzznel: Nqq N, O, P | summary: Add A, B, C | o changeset: 0:b00443a54871 user: test date: Thu Jan 01 00:00:00 1970 +0000 fhzznel: Ebbg summary: Root