Commit Graph

584 Commits

Author SHA1 Message Date
Steven Brown
d042b9d9a8 web: provide the file number to the diffstat templates
This allows the diffstat templates to link into the diff output. For example,
the URLs of the first three files within the diff are #l1.1, #l2.1, #l3.1.
2011-06-09 01:15:49 +08:00
Steven Brown
b9c161f1f5 web: include all files in the diffstat
The webutil.diffstat function now returns a diffstat template for each file
in the diff. It previously returned a template for each file returned by
ctx.files() which did not work well for merge changesets.
2011-06-09 01:14:22 +08:00
Steven Brown
ef568e7358 web: prevent TypeError thrown when using the diffstat templates
Remove the lambda used to wrap webutil.diffstat because:
- functions passed to the templater must accept keyword arguments
- webutil.diffstat is a generator, so already calculates the diffstat lazily

This reverts the changes made to a4067e29e29d after it was submitted to the
mailing list but before it was queued.
2011-06-02 18:52:31 +08:00
Martin Geisler
af8a35e078 check-code: flag 0/1 used as constant Boolean expression 2011-06-01 12:38:46 +02:00
Steven Brown
a8c12e93a7 web: provide diffstat to the changeset page
This includes all affected files, so it can be used for an extended view of
the files or as a replacement for the filenodelink and filenolink templates.
2011-05-28 14:44:45 +08:00
Adrian Buehlmann
0e6715fa28 rename util.set_binary to setbinary 2011-05-06 15:25:35 +02:00
Matt Mackall
89ec131e91 http: minor tweaks to long arg handling
x-arg -> x-hgarg
replace itertools.count(1)
2011-05-01 03:51:04 -05:00
Steven Brown
c1075f3880 httprepo: long arguments support (issue2126)
Send the command arguments in the HTTP headers. The command is still part
of the URL. If the server does not have the 'httpheader' capability, the
client will send the command arguments in the URL as it did previously.

Web servers typically allow more data to be placed within the headers than
in the URL, so this approach will:
- Avoid HTTP errors due to using a URL that is too large.
- Allow Mercurial to implement a more efficient wire protocol.

An alternate approach is to send the arguments as part of the request body.
This approach has been rejected because it requires the use of POST
requests, so it would break any existing configuration that relies on the
request type for authentication or caching.

Extensibility:
- The header size is provided by the server, which makes it possible to
  introduce an hgrc setting for it.
- The client ignores the capability value after the first comma, which
  allows more information to be included in the future.
2011-05-01 01:04:37 +08:00
Brodie Rao
b7f0d2a103 url: move URL parsing functions into util to improve startup time
The introduction of the new URL parsing code has created a startup
time regression. This is mainly due to the use of url.hasscheme() in
the ui class. It ends up importing many libraries that the url module
requires.

This fix helps marginally, but if we can get rid of the urllib import
in the URL parser all together, startup time will go back to normal.

perfstartup time before the URL refactoring (707e4b1e8064):

! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

current startup time (9ad1dce9e7f4):

! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

after this change:

! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
2011-04-30 09:43:20 -07:00
Martin Geisler
a5dc911698 merge with mpm 2011-04-30 15:30:51 +02:00
Martin Geisler
e57b3a9f70 hgweb: initialize permhooks at definition time
This is simpler than creating it empty and then appending the default
checkauthz hook 50 lines below.
2011-04-30 13:47:22 +02:00
Alexander Solovyov
23228e2ea0 drop {short,hex}(ctx.node()) calls in favor of ctx methods 2011-04-30 12:55:07 +02:00
Alexander Solovyov
f4250e8e9c graphlog: make use of graphmod's revset support 2011-04-23 15:04:15 +02:00
Adrian Buehlmann
267c80394b move walkrepos from util to scmutil 2011-04-21 16:06:19 +02:00
Adrian Buehlmann
f3e8eae526 move canonpath from util to scmutil 2011-04-20 21:41:41 +02:00
Steven Stallion
6daa9da6c9 hgweb: support disabling page cache
By default, hgweb_mod supports caching via the ETag header. This can
cause some confusion with browsers which cache aggressively. This change
preserves existing behavior while giving the administrator a knob to
disable the ETag header.
2011-04-20 00:01:50 -04:00
Steven Stallion
239482dbab hgweb: support alternate logo url
Clicking on the logo image/text in the hgweb interface brings the
user to the Mercurial project page. The majority of users expect that
this would bring them to the top level index. I have added a new template
variable named `logourl' which allows an administrator to change this
behavior. To stay compatible with existing behavior, `logourl' will
default to http://mercurial.selenic.com/. This change is very useful in
large installations where jumping to the index is common.
2011-04-19 23:37:06 -04:00
Martin Geisler
5a3f4fec03 merge with stable 2011-04-19 15:19:54 +02:00
Martin Geisler
6cd55d2029 hgweb: detect change based on changelog size too
Before, there was a race between an access and a modification made
within the same second.
2011-04-19 15:15:56 +02:00
Md. O. Shayan
20e62c51a1 hgweb: set minimum number of revision to display to 1 when revcount is 0
When revcount goes to 0 nothing is displayed in hgweb. This patch sets revcount to max(revcount, 1).
2011-04-13 07:40:24 +05:30
Yuya Nishihara
109c433261 hgweb: add bookmarks listing to summary page of gitweb/monoblue styles 2011-04-10 10:01:42 +09:00
Yuya Nishihara
fe54e1ef28 hgweb: remove useless notip handling from bookmarks listing 2011-04-10 10:01:39 +09:00
Yuya Nishihara
723e882e64 hgweb: sort bookmarks in the same manner as console command 2011-04-10 10:01:37 +09:00
Md. O. Shayan
43492ff710 hgweb: fix inconsistant display of graphlog (issue1706) 2011-04-07 13:23:07 +05:30
Yuya Nishihara
95ce899cb1 hgweb: add bookmark labels to monoblue theme (based on 4d7cfa1867b5) 2011-03-30 02:22:15 +09:00
Martin Geisler
be192b7fa4 merge with stable 2011-04-07 11:40:54 +02:00
Brodie Rao
744f9e0914 hgweb: use url.url when setting CGI environment variables 2011-03-30 20:01:46 -07:00
Matt Mackall
1d9a1adcf9 merge with stable 2011-03-30 13:23:24 -05:00
timeless@gmail.com
a09c2a5533 hgwebdir: handle IOErrors from localrepo while enumerating
Repository() raises a number of IOErrors in addition to RepoErrors.
 these are just as uninteresting as RepoErrors and should be ignored

The easiest case of this is a repo whose .hg/ directory is -rx
2011-03-29 16:33:10 +00:00
Dirkjan Ochtman
43eea49bf4 hgweb: pmezard thinks one default is enough 2011-03-12 16:00:54 +01:00
Dirkjan Ochtman
d17590d4e7 deal with empty Content-Length headers 2011-03-12 15:21:45 +01:00
Alexander Solovyov
84912d6eaf hgweb: add separate page with bookmarks listing 2011-03-12 11:20:03 +01:00
Alexander Solovyov
e67bfa95ac hgweb: add display of bookmarks for changelog and changeset 2011-03-12 11:19:44 +01:00
Mads Kiilerich
53a7e81f78 hgweb: handle invalid requests with both form data and querystring
Invalid requests could give an unhandled ErrorResponse.

Now this ErrorResponse is handled like other ErrorResponses so the client gets
an error message which also is logged on the server.
2011-02-21 00:57:19 +01:00
Mads Kiilerich
4a3ec69835 hgweb: give ErrorResponse a descriptive string/Exception representation
Very handy if the exception should appear in output.
2011-02-21 00:52:26 +01:00
Mads Kiilerich
c77a84761e serve: catch and log all Exceptions, not only StandardException
Other exceptions than StandardExceptions were left to the default error handler
which was muted when running in daemon mode.

Now all Exceptions are handled and logged to the log file.
2011-02-21 00:52:23 +01:00
Wagner Bruna
44bdaed8cd hgwebdir: reduce memory usage for index generation
The archive list generator was holding a reference to each
temporary ui copy passed by rawentries(), so the memory
usage for index generation growed proportionally to the
ui object size and the amount of repositories. By returning a
list instead, the temporary reference is dropped immediately.
2011-02-17 18:05:27 -02:00
Mads Kiilerich
75f680564e hgweb: make paths wildcards expanding in a repo root match repo correctly
There was a trailing '/' too much when the wildcard part expanded to nothing.
The consequence was that the repo was announced but didn't work.
2011-02-15 01:04:10 +01:00
Mads Kiilerich
6e8efc0e0c hgweb: doctest of url creation from wildcard expansion 2011-02-15 01:04:10 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Matt Mackall
f6fde7c0c9 merge with stable 2010-12-29 15:31:25 -06:00
Matt Mackall
e6a9c922d9 hgweb: abort if config file isn't found 2010-12-29 15:23:16 -06:00
Oli Thissen
19beab3bf6 hgweb: added revision date to annotate line data
The only revision information yielded by the annotate view was the revision
number itself. The patch allows the use of per-line revision dates in the
corresponding templates.
2010-12-06 16:56:06 +01:00
Wagner Bruna
e391a0d422 hgwebdir: fix incorrect index generation for invalid paths (issue2023)
8aa8db6deb47 moved the subdirectory match inside the repository match
loop. A virtual path existing/path/invalid/path would then match
existing/path, and generate a wrong index page.
2010-11-30 12:45:25 -02:00
Mads Kiilerich
edd19f159b hgweb: let HTTPS serve use more compatible and less secure encryption
PROTOCOL_SSLv3 on the server side doesn't work everywhere. Sometimes the client
reports "EOF occurred in violation of protocol" (for example on Mac and Solaris).

The more compatible PROTOCOL_SSLv23 is now used instead. It works but is less
"secure" for some OpenSSL versions as it can fall back to weak encryption.
2010-10-21 03:18:52 +02:00
Mads Kiilerich
affe4fdcad hgweb: use Pythons ssl module for HTTPS serve when using Python 2.6 or later
pyOpenSSL apparently doesn't work for Python 2.7 and isn't very actively
maintained.

The built-in ssl module seems like a long-term winner, so we now use that with
Python 2.6 and higher.
2010-10-20 20:19:34 +02:00
Mads Kiilerich
1edb529392 hgweb: refactor all pyOpenSSL references into one class 2010-10-20 20:19:32 +02:00
Mads Kiilerich
c627f511ce serve: fix https mode and add test
The https mode failed in super because BaseRequestHandler is an old-style
class.

This introduces the first test of https client/server functionality - and
"hghave ssl". The test is currently only run on Python 2.6.
2010-10-17 04:13:35 +02:00
Augie Fackler
4ec8b25214 hgweb: don't send a body or illegal headers during 304 response
Without this fix, mod_wsgi and spawning get in a wedged state after
sending a 304 response. Not sending a body fixed that problem. The
header change was discovered by using wsgiref.validate.validator to
check for other errors.
2010-10-16 17:29:04 -05:00
Benoit Boissinot
9bd037b429 wireproto/http: drain the incoming bundle in case of errors 2010-10-11 12:47:11 -05:00