Commit Graph

602 Commits

Author SHA1 Message Date
Matt Mackall
944b7f7b5c pyflakes: clean up some import noise 2011-10-11 23:16:05 -05:00
Andrew Pritchard
2d8acb3e0b wireproto: add out-of-band error class to allow remote repo to report errors
Older clients will still print the provided error message and not much else:
over ssh, this will be each line prefixed with 'remote: ' in addition to an
"abort: unexpected response: '\n'"; over http, this will be the '---%<---'
banners in addition to the 'does not appear to be a repository' message.

Currently, clients with this patch will display 'abort: remote error:\n' and
the provided error text, but it is trivial to style the error text however is
deemed appropriate.
2011-08-02 15:21:10 -04:00
Matt Mackall
bd0261e46e merge with stable 2011-08-01 18:10:05 -05:00
Matt Mackall
b170d63e2a hgweb: extract the path logic from updatereqenv and add doctests 2011-08-01 14:53:10 -05:00
Matt Mackall
eb714d4d00 merge with stable 2011-08-01 14:52:11 -05:00
Matt Mackall
e75325116a merge with stable 2011-08-01 10:54:34 -05:00
wujek
05cf460c3e hgweb: handle 'baseurl' configurations with leading slash (issue2934) 2011-08-01 09:48:10 +02:00
Matt Mackall
9dd4882287 hgweb: raw file mimetype guessing configurable, off by default (BC) (issue2923)
Before: hgweb made it possible to download file content with a content type
detected from the file extension. It would serve .html files as text/html and
could thus cause XSS vulnerabilities if the web site had any kind of session
authorization and the repository content wasn't fully trusted.

Now: all files default to "application/binary", which all important
browsers will refuse to treat as text/html. See the table here:

https://code.google.com/p/browsersec/wiki/Part2#Survey_of_content_sniffing_behaviors
2011-07-31 01:46:52 +02:00
Augie Fackler
8e5c4fa38c http2: send an extra header to signal a non-broken client
Some proxies strip the expect header because they forward requests in
a non-compliant way or as a way to defend against bogus clients.
2011-07-27 18:35:35 -05:00
Jesse Long
33d5742949 hgweb: treat branch attribute closed' as more important than inactive'
In the branches page, branches that are closed and are merged into another
branch are displayed as `inactive'. This patch changes that behaviour to
show these branches as `closed'.

For me, the `closed' attribute is more important than the `inactive'
attribute.

Branches that are not closed, and are merged into other branches will still
be shown as `inactive'.

Branches that are closed, and are not merged into other branches will still
be shown as `closed'.
2011-06-29 09:36:45 +02:00
Thomas Arendsen Hein
692a53d202 classes: fix class style problems found by 06e968819ac9
This makes test-wireprotocol.py work on Python 2.4
2011-06-29 15:00:00 +02:00
Idan Kamara
325f77da0a ui: use I/O descriptors internally
and as a result:
- fix webproto to redirect the ui descriptors instead of sys.stdout/err
- fix sshserver to use the ui descriptors
2011-06-08 01:39:20 +03:00
Steven Brown
d6246b1341 web: provide diff summary to the changeset page
This is the same message displayed at the end of the "diff --stat" command.
For example, "9 files changed, 1651 insertions(+), 2 deletions(-)".

The webutil.diffstatgen function allows the diffstat data to be lazily
calculated only once and then re-used.
2011-06-11 21:11:43 +08:00
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
Augie Fackler
5997cc6e9c hgweb: move remaining hasattr calls to safehasattr 2011-07-25 15:38:46 -05:00
Augie Fackler
1e620f0aad wsgicgi: use getattr instead of hasattr 2011-07-25 15:38:10 -05:00
Augie Fackler
caa4218c37 hgweb_mod: use safehasattr instead of hasattr 2011-07-25 16:27:08 -05:00
Augie Fackler
2e41c2e64a globally: use safehasattr(x, '__iter__') instead of hasattr(x, '__iter__') 2011-07-25 15:30:19 -05:00
Angel Ezquerra
9f2d3a19a5 hgweb: add a "web/logoimg" setting to customize the web logo image
This change complements the existing web/logourl setting, and lets the user
customize the logo image that is shown on many of the hg server pages.

If this setting is not set, hglogo.png is used.
2011-07-21 15:10:16 +02: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