Commit Graph

292 Commits

Author SHA1 Message Date
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Dirkjan Ochtman
c93b170e46 hgweb: don't choke when an inexistent style is requested (issue1901) 2009-11-12 16:39:11 +01:00
Dirkjan Ochtman
0032b55ff7 hgweb: treat rev as raw-rev if user agent is hg 2009-11-06 22:46:46 +01:00
Benoit Boissinot
a082a7dc75 hgweb: deny cloning a subpath of a repo 2009-06-20 16:42:51 -05:00
Matt Mackall
067d110f29 hgweb: web.encoding should override encoding.encoding (issue1183) 2009-06-20 13:00:25 -05:00
Martin Geisler
3f7c86dc69 wrap string literals in error messages 2009-05-31 01:30:16 +02:00
Brendan Cully
5779dfb1e0 hgweb: Make get_mtime use repository to find store path.
It was calculating it directly, which is redundant and caused
it to break with shared repositories.
2009-12-15 12:33:04 -08:00
Sune Foldager
69c1e615e4 hgweb: add support for extension-provided permission hooks
This allows extensions to hook into permission checking, providing both
authentication and authorization as needed. The existing authorization
function has been changed to a hook, which is added by default.
2009-11-23 11:03:55 +01:00
Henrik Stuart
b33980d016 hgweb: fix error in bb95879961db and introduce test for change 2009-11-19 15:54:57 +01:00
Sune Foldager
5063be569c ui: add environ property to access os.environ or wsgirequest.environ
The property returns os.environ by default, and is propagated by ui.copy.
During hgweb processing, ui.environ is set to the proper WSGI-request
environment, as contained in wsgirequest.environ. For CGI, this is the
same as os.environ.

The property is meant to be read-only, as with os.environ (generally).
2009-11-19 10:32:33 +01:00
Peter Arrenbrecht
a75765cf7f drop unused imports 2009-05-14 15:35:46 +02:00
Dirkjan Ochtman
5c6c43b746 templater: provide the standard template filters by default 2009-05-12 12:04:05 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
ba8099cfb8 hgweb: kill parentui references 2009-04-26 16:50:43 -05:00
Matt Mackall
ebffe5ccb8 ui: refactor option setting
No more passing options as constructor keywords. Basic options are now
always stored in the overlay for simplicity and consistency.
2009-04-23 15:40:10 -05:00
Dirkjan Ochtman
0b1a57839b templater: move stylemap function from hgweb to templater 2009-04-04 17:46:11 +02:00
Matt Mackall
642f4d7151 move encoding bits from util to encoding
In addition to cleaning up util, this gets rid of some circular dependencies.
2009-04-03 14:51:48 -05:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Benoit Boissinot
35d90d90ba hgweb: fix allow_read permissions when a user is specified
Thanks to Juan Pablo Aroztegi for reporting and debugging it.
2009-03-07 00:59:41 +01:00
Dirkjan Ochtman
b2c394e625 hgweb: pass ErrorResponses directly into req.respond() 2009-02-09 11:29:09 +01:00
Matt Mackall
e0735a1762 error: move repo errors
rename NoCapability to CapabilityError
2009-01-12 10:42:31 -06:00
Matt Mackall
d15d559b7c errors: move revlog errors
- create error.py for exception classes to reduce demandloading
- move revlog exceptions to it
- change users to import error and drop revlog import if possible
2009-01-11 22:48:28 -06:00
Dirkjan Ochtman
e91c670197 hgweb: fix long line lengths introduced in 9c98746d7c2b 2009-01-03 21:44:15 +01:00
Mark Edgington
fcbe766152 hgweb: send HTTP unauthorized error when denying pull 2009-01-03 20:50:06 +01:00
Mark Edgington
173e246bb8 hgweb: allow static content when deny_read denies access 2009-01-03 20:33:19 +01:00
Brendan Cully
f4cee1477f templater: return data in increasing chunk sizes
Currently hgweb is not streaming its output -- it accumulates the
entire response before sending it. This patch restores streaming
behaviour. To avoid having to synchronously write many tiny fragments,
this patch also adds buffering to the template generator. Local
testing of a fetch of a 100,000 line file with wget produces a slight
slowdown overall (up from 6.5 seconds to 7.2 seconds), but instead of
waiting 6 seconds for headers to arrive, output begins immediately.
2008-11-21 15:51:40 -08:00
Dirkjan Ochtman
2b37453255 merge with mpm 2008-11-08 00:29:04 +01:00
Dirkjan Ochtman
f8d7226e5f hgweb: fix up the less/more links on the graph page
Previously, they pointed to a non-intuitive revision, and got borked when
using a URL-specified style combined with alternate revcounts.
2008-11-07 23:31:12 +01:00
Matt Mackall
076f93ace1 hgweb: Change default style to paper 2008-11-06 11:56:01 -06:00
Mark Edgington
bf5852441b hgweb: support for deny_read/allow_read options
reimplementation of a patch provided by Nilton Volpato.

Folded into a single patch by Thomas Arendsen Hein.
2008-10-31 15:28:06 +01:00
Dirkjan Ochtman
9cd425cc1b hgweb: move another utility function into the webutil module 2008-11-03 20:31:53 +01:00
Dirkjan Ochtman
5e743c6696 hgweb: move the diffs() generator into webutil 2008-11-03 20:41:48 +01:00
Dirkjan Ochtman
17464b3066 hgweb: use patch.diff() to make sensible diffs (issue1223, issue1258)
This gets us git diffs when enabled and doesn't pick erratic file parents.
2008-11-03 20:05:03 +01:00
Brendan Cully
795ad024bb hgweb: handle subdirectories within static directory 2008-10-28 21:58:30 -07:00
Dirkjan Ochtman
e7f8861527 hgweb: be sure to drain request data even in early error conditions
Thanks to Mads Kiilerich with noticing this. The hg client can only read data
after all the sent data has been read, so we have to read all the request data
even if we're not going to do anything with it (in error conditions). This
is not easy to fix in the client, because we're using Python's httplib, which
is strictly stateful. Abstracted the draining into a separate method.
2008-10-20 10:15:26 +02:00
Dirkjan Ochtman
0c1845ffb9 hgweb: return content iterator instead of using write() callable
This is a new version of b6b16fec2a60 (which was backed out in faf83e1e40f5),
with an extra line removed to fix problems with hg serve. hg's internal web
server contains checking if the app isn't trying to write more bytes than
specified by the Content-Length header. The first try still contained an old
line that wrote the response, so the response was sent twice.
2008-08-30 17:13:23 +02:00
Dirkjan Ochtman
b3dea85ba6 hgweb: raise ErrorResponses to communicate protocol errors 2008-07-22 18:23:20 +02:00
Martin Geisler
5fdc874d26 hgweb: removed unnecessary del before function return
Deleting tmpl just before the return statement should have no effect
since tmpl goes out of scope anyway. But it confuses pyflakes who
thinks tmpl is undefined when it is used in the except blocks below.
2008-08-16 16:32:57 +02:00
Dirkjan Ochtman
1599d4d765 merge another backout 2008-07-02 12:27:57 +02:00
Dirkjan Ochtman
0bf39aa189 Backed out changeset b6b16fec2a60 (incorrect Content-Length on Windows) 2008-07-02 12:02:33 +02:00
Dirkjan Ochtman
35c3380f04 hgweb: return content iterator instead of using write() callable 2008-06-29 22:36:18 +02:00
Dirkjan Ochtman
d50a34e7a6 hgweb: all protocol functions have become generators
Using the write() callable supplied by the start_response() call is
frowned upon by the WSGI spec, returning an iterable over the content chunks
is the recommended way. Be aware, though: returning many small chunks will
slow down responses, because the server has to flush each chunk separately.
2008-06-29 15:23:09 +02:00
Dirkjan Ochtman
ea85ac1c36 hgweb: protocol functions take repo instead of web
This makes it much easier for implementers of hgweb alternatives to simply
call into protocol functions after setting up a repo and a request.
2008-06-29 11:34:36 +02:00
Dirkjan Ochtman
daead2920b hgweb: move capabilities calculation back into hgweb.protocol 2008-06-29 11:35:08 +02:00
Dirkjan Ochtman
e28d0d4d77 hgweb: centralize permission checks for protocol commands
Consistently enforces authorization checks set up in hgrc up front, so that
the actual commands don't have to worry about them and implementers of
hgweb alternatives can easily implement their own permission checks.
2008-06-29 11:35:06 +02:00
Dirkjan Ochtman
ea809de249 hgweb: protocol requests are processed immediately
This makes separation of interface/webcommands and protocol easier and will
make http repos slightly faster because there's less overhead.
2008-06-28 15:28:43 +02:00
Dirkjan Ochtman
76f4a6be28 merge with mpm 2008-06-28 09:28:01 +02:00
Dirkjan Ochtman
f174f95f70 hgweb: move shortcut expansion to request instantiation 2008-06-26 13:45:39 +02:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Dirkjan Ochtman
67493fd86d Merge from crew-stable. 2008-04-03 13:21:42 +02:00
Dirkjan Ochtman
95639b6467 hgweb: make hgwebdir work in the absence of PATH_INFO
Thanks to Andrea Arcangeli for reporting and an initial patch.
2008-04-03 13:14:43 +02:00
Dirkjan Ochtman
ef391be22f hgweb: refactor hgweb code 2008-03-28 19:40:44 +01:00
Dirkjan Ochtman
9c32b06e9a hgweb: separate out utility functions 2008-03-28 19:37:28 +01:00
Dirkjan Ochtman
9731167667 Backed out changeset a3eeb13e3d5c (temporary template compatibility) 2008-03-24 18:18:39 +01:00
Alexis S. L. Carvalho
506e114776 hgweb: add compatibility code for old templates
Up to changeset 6713db859c82, HTTP headers were expected to be embedded
in the "headers" template.  Since that changeset, the content-type is
supposed to be defined as the "mimetype" template in the map file.

This changeset makes sure the old templates still work.
2008-03-24 13:45:01 -03:00
Dirkjan Ochtman
bddf3af283 hgweb: fix breakage in python < 2.5 introduced in 664786dcb24f 2008-03-24 16:20:15 +01:00
Dirkjan Ochtman
056bb10b17 hgweb: better error messages 2008-03-23 23:08:18 +01:00
Florent Guillaume
c1858ea074 hgweb_mod: add branch helper functions to use in templates 2008-03-13 23:45:35 +01:00
Joel Rosdahl
c26213193c Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg 2008-03-06 22:51:16 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Thomas Arendsen Hein
cc608e0715 hgweb/annotate: handle binary files like hgweb/file 2008-03-02 23:32:13 +01:00
Dirkjan Ochtman
b1672f1ac2 hgweb: fix parameter mixup (issue1001) 2008-02-23 11:19:59 +01:00
Dirkjan Ochtman
cdb32d9cc8 hgweb: use bundletypes from mercurial.changegroup 2008-02-21 15:00:25 +01:00
Dirkjan Ochtman
be3fb00c67 hgweb: separate protocol calls from interface calls (issue996)
The protocol functions are already pretty careful about not raising
exceptions to the caller, and have their own error handling. We can formalize
this a little bit to make it clearer (before, the exception handlers for
a limited number of exceptions coming from the interface bits would blow up
because some variables aren't instantiated for the protocol calls).
2008-02-20 10:50:10 +01:00
Thomas Arendsen Hein
6f399a19b1 merge backout 2008-02-18 19:21:33 +01:00
Thomas Arendsen Hein
4d33c02751 Backed out changeset 8105fa3c7347 (see issue971/msg5317) 2008-02-18 19:20:22 +01:00
Bryan O'Sullivan
dfa3e1ea9b profiling: allow CGI and FastCGI to be profiled 2008-02-01 13:09:45 -08:00
Dirkjan Ochtman
3d668210f2 hgweb: explicit response status 2008-02-01 10:31:13 +01:00
Matt Mackall
41e5c79455 templates: move filters to their own module
This eliminates just about all Mercurial dependencies in templater.py
2008-01-31 14:44:19 -06:00
Dirkjan Ochtman
8ee250977c hgweb: centralize req.write() calls 2008-01-28 15:10:17 +01:00
Dirkjan Ochtman
3b49a144eb hgweb: explicitly check if requested command exists 2008-01-28 14:58:03 +01:00
Dirkjan Ochtman
6bc7bb23af hgweb: get rid of raw-related code in hgweb.filerevision() 2008-01-28 13:42:40 +01:00
Dirkjan Ochtman
4ea6b6bcae send conservatively capitalized HTTP headers 2008-01-23 14:28:25 +01:00
Dirkjan Ochtman
702f1f50b2 hgweb: move HTTP content types out of header templates
This removes the ability for templates to add custom HTTP headers, which can
easily be re-added if someone needs it. Thanks to asak for repeatedly reviewing
this patch and helping to iron out the quirks.
2008-01-22 10:45:55 +01:00
Dirkjan Ochtman
f4b035d012 hgweb: fix a stupid KeyError introduced in 109699000009
Thanks to Christian Ebert for finding this. Also added a test to prevent this
from happening again.
2008-01-22 09:11:08 +01:00
Christian Ebert
5c18a69d2e Prefer i in d over d.has_key(i) 2008-01-20 14:39:25 +01:00
Dirkjan Ochtman
4de316f884 hgweb: fast path for sending raw files 2008-01-18 19:53:38 +01:00
Dirkjan Ochtman
a854166262 hgweb: just return iterables instead of yielding them 2008-01-18 19:53:38 +01:00
Dirkjan Ochtman
0d71615663 hgweb: remove some legacy code 2008-01-18 19:53:38 +01:00
Matt Mackall
f277b2676b hook: redirect stdout to stderr for ssh and http servers 2008-01-11 13:06:38 -06:00
Thomas Arendsen Hein
1566cda979 Don't let ui.username override web.contact (issue900)
63beab327d26 introduced using ui.username before web.contact, but this was
never documented and might cause commit accidents.

- Drop web.author (deprecated since 2005)
- Try ui.username or $EMAIL as a fallback to display something useful.
- Update docs for the fallbacks.
2008-01-01 17:07:15 +01:00
Dirkjan Ochtman
2365373281 hgweb: explicitly pass around the templater 2007-12-03 13:30:08 +01:00
Dirkjan Ochtman
031b079856 hgweb: split out templater definition 2007-12-03 12:40:29 +01:00
Dirkjan Ochtman
e2b08400db separate the wire protocol commands from the user interface commands 2007-12-03 12:27:11 +01:00
Dirkjan Ochtman
8169e83987 hgweb: extract constant to global level 2007-12-03 12:06:21 +01:00
Dirkjan Ochtman
4391298487 hgweb: get rid of some nested functions 2007-12-03 11:58:52 +01:00
Dirkjan Ochtman
b14cdb9ce4 fix some imports; pushing bz2 bundles over http is currently untested 2007-12-03 11:58:29 +01:00
Dirkjan Ochtman
58139af39c split out hgweb commands into a separate file, move some code around 2007-12-02 23:26:40 +01:00
Dirkjan Ochtman
a20c52b449 Use SCRIPT_NAME and PATH_INFO instead of REQUEST_URI. This is required by WSGI (fixes issue846). 2007-12-01 19:19:08 +01:00
Dirkjan Ochtman
eb63af80e4 Less indirection in the WSGI web interface. This simplifies some code, and makes it more compliant with WSGI. 2007-11-30 18:23:18 +01:00
Bryan O'Sullivan
4fa397a600 Drop a bad import that snuck in. 2007-11-28 13:58:31 -08:00
Bryan O'Sullivan
9ae1a2c354 hgweb: fix breaking tests on Python < 2.5 2007-11-28 09:39:17 -08:00
Bryan O'Sullivan
e19dabc11f hgweb: return meaningful HTTP status codes instead of nonsense 2007-11-28 08:38:42 -08:00
Rocco Rutte
49a794484a hgweb_mod: update unidiff() calls and finish f2af74bd8f86 job 2007-11-03 17:04:42 +01:00
Thomas Arendsen Hein
1b84b0de7c Make hgweb annotate link to target line numbers (issue623) 2008-02-15 21:34:16 +01:00
Thomas Arendsen Hein
ad12af151f merged Edward Lee's line anchors patch 2008-02-15 19:44:54 +01:00
Edward Lee
9f8402d3c0 Add line anchors to annotate, changeset, diff, file views for hgweb 2007-09-04 22:25:37 -05:00
Thomas Arendsen Hein
1d27b34424 merge with crew-stable 2008-02-05 14:34:46 +01:00
Dirkjan Ochtman
8f3b12c02f hgweb: fix search skipping tip 2008-02-05 14:02:03 +01:00