Commit Graph

584 Commits

Author SHA1 Message Date
John Mulligan
8806103077 localrepo: remove 'closed' argument to heads(...) function
- repository heads are not associated with the closed attribute, so
remove it making the code in line with the concept.
- Fix functions that were calling heads with the parameter.
- Adjust webcommands.branches to include the concept of inactive
as well as open and closed branches
- Fix code and docstrings in commands to make the correct use of
closed branches & branch heads clearer
- Improve grammar of 'hg heads' help text (2nd submission)

this does not alter the cli for hg branches, that work is
still to be done
2009-06-10 19:11:49 -04:00
timeless
fb33de67af Generally replace "file name" with "filename" in help and comments. 2009-06-09 09:25:17 -04:00
Dirkjan Ochtman
176bc50a2d hgweb: allow distinction between open/closed branches on branches page 2009-06-04 18:05:50 +02:00
Martin Geisler
3f7c86dc69 wrap string literals in error messages 2009-05-31 01:30:16 +02:00
Dirkjan Ochtman
e4b1a0608c hgweb: extract config values after reading webdir-config 2009-05-26 10:16:17 +02:00
Henrik Stuart
e3379206dc named branches: server branchmap wire protocol support (issue736)
The repository command, 'branchmap', returns a dictionary, branchname
-> [branchheads], and will be implemented for localrepo, httprepo and
sshrepo.

The following wire format is used for returning data:

branchname1 branch1head2 branch1head2 ...
branchname2 ...
...

Branch names are URL encoded to escape white space, and branch heads
are sent as hex encoded node ids. All branches and all their heads are
sent.

The background and motivation for this command is the desire for a
richer named branch semantics when pushing changesets. The details are
explained in the original proposal which is included below.


1. BACKGROUND

The algorithm currently implemented in Mercurial only considers the
graph theoretical heads when determining whether new heads are
created, rather than using the branch heads as a count (the algorithm
considers a branch head effectively closed when it is merged into
another branch or a new named branch is started from that point
onward).

Our particular problem with the algorithm is that we'd like to see the
following case working without forcing a push:

Upsteam has:

(0:dev) ---- (1:dev)
\
 `--- (2:stable)

Someone merges stable into dev:

(0:dev) ---- (1:dev) ------(3:dev)
\                         /
 `--- (2:stable) --------´

This can be pushed without --force (as it should).
Now someone else does some coding on stable (a bug fix, say):

(0:dev) ---- (1:dev) ------(3:dev)
\                          /
 `--- (2:stable) ---------´---------(4:stable)

This time we need --force to push.

We allow this to be pushed without using --force by getting all the
remote branch heads (by extending the wire protocol with a new
function).

We would, furthermore, also prefer if it is impossible to push a new
branch without --force (or a later --newbranch option so --force isn't
shoe-horned into too many disparate functions, if need be), except of
course in the case where the remote repository is empty.

This is what our patches accomplish.


2. ALTERNATIVES

We have, of course, considered some alternatives to reconstructing
enough information to decide whether we are creating new remote branch
heads, before we added the new wire protocol command.

2.1. LOOKUP ON REMOTE

The main alternative is to use the information from remote.heads() and
remote.lookup() to try to reconstruct enough graph information to
decide whether we are creating new heads. This is not adequate as
illustrated below.

Remember that each lookup is typically a request-response pair over
SSH or HTTP(S).

If we have a simple repository at the remote end like this:

(0:dev) ---- (1:dev) ---- (3:stable)
\
 `--- (2:dev)

then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2]
locally and want to create a new node, 4:dev, as a descendant from
(1:dev), which should be OK as 1:dev is a branch head.

If we do remote.lookup('dev') we will get [2]. Thus, we can get
information about whether a branch exists on the remote server or not,
but this does not solve our problem of figuring out whether we are
creating new heads or not.

Pushing 4:dev ought to be OK, since after the push, we still only have
two heads on branch a.

Using remote.lookup() and remote.heads() is thus not adequate to
consistently decide whether we are creating new remote heads (e.g. in
this situation the latter would never return 1:dev).

2.2. USING INCOMING TO RECONSTRUCT THE GRAPH

An alternative would be to use information equivalent to hg incoming
to get the full remote graph in addition to the local graph.

To do this, we would have to get a changegroup(subset) bundle
representing the remote end (which may be a substantial amount of
data), getting the branch heads from an instantiated bundlerepository,
deleting the bundle, and finally, we can compute the prepush logic.

While this is backwards compatible, it will cause a possibly
substantial slowdown of the push command as it first needs to pull in
all changes.


3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION

Currently, the commands incoming and pull, work based on the tip of a
given branch if used with "-r branchname", making it hard to get all
revisions of a certain branch only (if it has multiple heads). This
can be solved by requesting the remote's branchheads and letting the
revisions to be used with the command be these heads. This can be done
by extending the commands with a new option, e.g.:

hg pull -b branchname

which will be turned into the equivalent of:

hg pull -r branchhead1 -r branchhead2 -r branchhead3

We have a simple follow-up patch that can do this ready as well
(although not submitted yet as it is pending the acceptance of the
branch patch).


4. WRAP-UP

We generally find that the branchmap wire protocol extension can
provide better named branch support to Mercurial. Currently, some
things, like the initial push scenario in this mail, are fairly
counter-intuitive, and the more often you have to force push, the more
it is likely you will get a lot of spurious and unnecessary merge
nodes. Also, restricting incoming and pull to all changes on a branch
rather than changes on the tip-most head would be a sensible extension
to making named branches a first class citizen in Mercurial.
Currently, named branches sometimes feel like a late-coming unwanted
step-child.

We have run it in a production environment for a while, with fewer
multiple heads occurring in our repositories and fewer confused users
as a result.

Also, it fixes the long-standing issue 736.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:02:49 +02:00
Patrick Mezard
f5c881c65f Merge with crew-stable 2010-01-03 18:16:42 +01: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
Thomas Arendsen Hein
baf6470a7a merge with crew-stable 2009-11-22 11:27:29 +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
Patrick Mezard
89b691f7f6 Merge with crew-stable 2009-05-21 22:41:18 +02:00
Patrick Mezard
1e0e3ba6d6 hgwebdir: fix [collections] evaluation under Windows
Virtual and real path separators are not the same under Windows.
2009-05-21 20:32:45 +02:00
Jeremy Whitlock
c090150d2d hgweb: make hgwebdir handle dict/list paths the same as config paths
Before this patch, the only way to get hgwebdir to honor the recursive paths
was to create a config object or a config file with the recursive paths in it.
This patch makes hgwebdir treat paths the same whether passed in as a list,
tuple, config or however hgwebdir supports passing paths.
2009-05-20 16:04:37 +02:00
Peter Arrenbrecht
a75765cf7f drop unused imports 2009-05-14 15:35:46 +02:00
Peter Arrenbrecht
3d9bf2f616 indentation cleanup 2009-05-14 15:24:36 +02:00
Bryan O'Sullivan
1674afb927 hgwebdir: refresh configuration periodically
The old default behaviour of hgwebdir was to maintain a list of
repositories permanently. This interacted badly with persistent
application hosting software such as WSGI containers.  If a new repository
was published, it would potentially never appear in the top-level list
of repositories.

This change causes the hgwebdir configuration and list of repositories
served to be refreshed periodically (at most every 20 seconds).
2009-05-13 13:30:28 -07:00
Dirkjan Ochtman
5c6c43b746 templater: provide the standard template filters by default 2009-05-12 12:04:05 +02:00
Dirkjan Ochtman
d939b28808 hgweb: trust config file passed into hgwebdir
Before this patch, hgwebdir suddenly showed up empty for a webdir-conf file
that was for some reason not trusted. This was previously not a problem because
the trust mechanism wasn't required for the very separate webdir-conf.
2009-05-12 10:57:55 +02:00
Dirkjan Ochtman
044ab8755d hgweb: use context api in branches webcommand 2009-05-12 10:23:45 +02:00
Sune Foldager
de66a009d3 webcommands: add 'branches' command, similar to 'tags' 2009-05-12 09:43:36 +02:00
Dirkjan Ochtman
1c646f503a hgweb: get rid of inaccurate hgwebdir.repos_sorted, localize machinery 2009-05-11 14:19:49 +02:00
Alexander Solovyov
038c7df455 hgwebdir: read --webdir-conf as actual configuration to ui (issue1586)
This cleans up code and allows specification of values more globally. For
example, it's now possible to specify web.contact in webdir-conf for all
repositories without a specified contact set.
2009-05-11 14:20:18 +02:00
Martin Geisler
eee44d410e webcommands: move nonempty logic from JavaScript to Python
This avoids hard-coding the '(none)' string in the JavaScript for each
style and avoids the {nonexisting|nonempty} hack which only works
since the template system don't complain about undefined variables.
2009-04-28 17:28:00 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Dirkjan Ochtman
ed04819e2f hgweb: pre-init mimetypes module (fixes ugly bug in python-2.6.2 mimetypes)
The ugly initialization hack in mimetypes' initialization procedure can make
hg serve hit the maximum recursion depth when in threaded mode.
2009-04-27 16:29:26 +02:00
Dirkjan Ochtman
bfe35438ae hgweb: use new sessionvars code in hgwebdir, too 2009-04-27 11:37:30 +02:00
Dirkjan Ochtman
dc1e18ddad hgweb: some cleanups in hgwebdir, remove double defaults
Removed obsolete command, expose useful cleannames function.
2009-04-27 11:37:08 +02:00
Matt Mackall
2f9b02c62d replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Matt Mackall
ba8099cfb8 hgweb: kill parentui references 2009-04-26 16:50:43 -05:00
Matt Mackall
be7d59ab85 ui: kill most users of parentui name and arg, replace with .copy() 2009-04-26 16:50:43 -05:00
Matt Mackall
8034ce6ca9 hgweb: use config.config 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
Ronny Pfannschmidt
5356baa346 switch lock releasing in the core from gc to explicit 2009-04-22 02:01:22 +02:00
Brodie Rao
cb9a8632f9 hgweb: fix undefined name RepoError 2009-03-27 11:17:46 -04: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
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
Martin Geisler
b5e430c97b hgweb: better English in IPv6 error message 2009-03-31 22:48:16 +02:00
Benoit Boissinot
868a1f07ed merge with -stable 2009-03-30 01:30:58 +02:00
Peter Arrenbrecht
ce6e853a0b cleanup: drop enumerate() when index is not used 2009-03-23 13:13:11 +01:00
Peter Arrenbrecht
19591b6a8c cleanup: drop unused assignments 2009-03-23 13:13:06 +01:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Dirkjan Ochtman
2ab2fbac87 hgweb: commit forgotten update to 94505a170e84 2009-02-09 13:08:32 +01:00
Sune Foldager
190a26b26d hgweb: support custom http headers in ErrorResponse 2009-02-09 11:31:52 +01:00
Dirkjan Ochtman
b2c394e625 hgweb: pass ErrorResponses directly into req.respond() 2009-02-09 11:29:09 +01:00
Dirkjan Ochtman
c7c236a145 hgweb: expose sibling branches to templater 2009-01-26 15:52:10 +01:00
Dirkjan Ochtman
d4c13c737f hgweb: simplify parents/children generation code 2009-01-19 13:20:47 +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
574603a8c0 use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
2009-01-12 09:16:03 +01:00
Benoit Boissinot
6b71924a1b merge with -stable 2009-01-09 18:12:53 +01:00
Benoit Boissinot
75e98806a7 web: use the correct filectx in filelog 2009-01-09 17:34:06 +01:00
Dirkjan Ochtman
074cf082f4 hgweb: fix problems with empty repositories 2009-01-04 19:10:42 +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
Dirkjan Ochtman
ad878f12a5 merge with crew-stable 2009-01-04 19:13:02 +01:00
Dirkjan Ochtman
e91c670197 hgweb: fix long line lengths introduced in 9c98746d7c2b 2009-01-03 21:44:15 +01:00
Patrick Mezard
b49af937a1 hgwebdir_mod: fix a performance issue with static files 2009-01-03 01:00:46 +01:00
Benoit Allard
6edf6273f0 hgweb: recurse down collections only if ** in [paths]
collections: direct child repos only
paths *: direct child repos only (like collections)
paths **: recursive discovery

When ** is used, the mq repository (if any) is also shown.
2008-12-18 22:32:48 +01:00
Patrick Mezard
9b8cb99ec1 hgweb: extend [paths] syntax to match repositories recursively (issue852)
This feature somehow duplicates [collections] but it is simpler to use and has
less issues under Windows where using absolute path as configuration file key
is not supported.

Suggested by Dirkjan Ochtman <dirkjan@ochtman.nl>
2008-12-01 14:20:20 +01:00
Dirkjan Ochtman
d963dd0023 kill some trailing spaces 2008-11-27 16:07:13 +01:00
Dirkjan Ochtman
50396f781f coal/paper: show branch name in changeset view 2008-11-25 22:53:01 +01:00
Benoit Allard
85a72f1622 coal/paper: display tags and branch in filelog page 2008-11-25 21:54:28 +01:00
Dirkjan Ochtman
5e58c613ca hgweb: support broken IIS 5 behavior with .cgi in PATH_INFO 2008-11-25 17:54:49 +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
Matt Mackall
b2807810c6 linkrev: take a revision number rather than a hash 2008-11-12 15:19:14 -06: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
a0fd77cd87 hgweb: fix pagination for graph 2008-11-07 15:40:36 +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
Ry4an Brase
555314efe8 hgweb: descend empty directories in web view
When a manifest has a series of directories with nothing in them but a single
directory, displaying the entire chain of empty directories allows for
navigation down to the first non-empty directory with a single click.

Because Java links package hierarchy to directory hierarchy, and because Java
conventions include at least three empty directories at the top of this
hierarchy, descending down empty directories is very common in Java web tools.
2008-11-03 10:20:28 +01:00
Dirkjan Ochtman
1450b6c29e hgweb: conditionally show file logs for deleted files 2008-11-01 13:07:24 +01:00
Dirkjan Ochtman
3708bb4a03 hgweb: pass more information about parent/child csets to templates 2008-10-30 09:46:45 +01:00
Brendan Cully
03a69e59f7 Allow per-file shadowing of static directory in templatepath 2008-10-28 22:24:17 -07:00
Brendan Cully
795ad024bb hgweb: handle subdirectories within static directory 2008-10-28 21:58:30 -07:00
Benoit Boissinot
94f1c13ccd fix missing import, spotted by pychecker 2008-10-28 20:14:45 +01:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Martin Geisler
da335e4675 i18n: import _ instead of gettext 2008-10-21 17:47:49 +02:00
Dirkjan Ochtman
cc867a892e hgweb: working diff for removed files 2008-10-20 14:13:37 +02:00
Dirkjan Ochtman
3bcd8d8cc6 hgweb: remove links to non-existent file versions 2008-10-20 12:41:09 +02: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
Brendan Cully
34868ca5be Allow hgweb to search for templates in more than one path.
This patch is constructed to make it easy for external extensions to
provide their own templates, by updating templater.path.
2008-10-17 11:34:31 -07:00
Benoit Boissinot
91038026cf hgweb: cleanup the manifest generation 2008-10-15 21:50:47 +02:00
Dirkjan Ochtman
d372202ca2 hgweb: let the web graph cope with low revisions/new repositories (issue1293) 2008-09-12 16:15:01 +02:00
Rocco Rutte
f70a5a0f4e hgweb: Respond with HTTP 403 for disabled archive types instead of 404
This makes it easier for clients/users to distinct between supported
but disabled and unsupported archive types.
2008-09-05 17:28:37 +02:00
Peter Ruibal
30a2036f9e use Exception(args)-style raising consistently (py3k compatibility) 2008-09-08 13:07:00 +02:00
Rocco Rutte
fd3e1122b0 hgweb: Serve raw non-binary files as text/plain
Previously these were served as application/octet-stream usually making
browsers download them as files though they can be displayed inline just
fine. This is useful to refer to e.g. /project/raw-file/tip/README.
2008-09-03 15:46:46 +02:00
Martin Geisler
28fb695e9a i18n: mark strings for translation in Mercurial 2008-08-31 16:12:02 +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
Dirkjan Ochtman
ecc1ada3d6 make streamclone.stream_out() a generator 2008-08-15 13:25:57 +02:00
Dirkjan Ochtman
793235765f hgweb: generate error message only if nothing is passed 2008-07-22 18:21:37 +02:00
Dirkjan Ochtman
afa3084f5f hgweb: fix WSGI iterators handling in CGI adapter (issue1254) 2008-08-21 10:55:24 +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
Martin Geisler
8c1d48c66f move % out of translatable strings
The translators need to see the raw format string, not the result of
using the format string.
2008-08-16 14:46:56 +02:00
Thomas Arendsen Hein
eeaee65118 Do not sort hgwebdir repositories if python list or tuple is given.
This was introduced by changeset 76e2de4eb18e (util: add sort helper)
2008-08-19 18:17:11 +02:00
Patrick Mezard
f278856373 Merge with crew-stable 2008-08-02 14:08:21 +02:00
Benoit Boissinot
1fe456f76c hgweb: do not use unassigned variables in exception handling 2008-08-01 12:33:10 +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
ca8485640e merge the backout head 2008-07-02 11:31:19 +02:00
Dirkjan Ochtman
8450fe59e5 Backed out changeset 1a3d3840a7eb (doesn't work on Python 2.3/2.4) 2008-07-02 10:58:27 +02:00
Dirkjan Ochtman
65c2146242 hgweb: use a single-element tuple to return from protocol.unbundle()
Python 2.3/2.4 don't support yielding from inside try/finally blocks.
2008-06-30 10:36:45 +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
abdd89596c streamclone yields chunks instead of accepting a file-like object 2008-06-29 14:20:01 +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
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Dirkjan Ochtman
f174f95f70 hgweb: move shortcut expansion to request instantiation 2008-06-26 13:45:39 +02:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Dirkjan Ochtman
423e92c03a graph: display branch name alongside tags 2008-06-23 12:54:27 +02:00
Benoit Allard
7efee05311 graph: limit the number of displayed changest to a reasonable value 2008-06-18 19:04:10 +02:00
Dirkjan Ochtman
4f94568371 add graph page to hgweb 2008-06-18 07:06:41 +02:00
Dirkjan Ochtman
8cce533c21 merge from crew-stable 2008-06-13 12:34:23 +02:00
Ali Saidi
665e4dbff1 fix traceback in hgweb when URL doesn't end in one of the archive specs
If the last n charecters of the URL doesn't match an entry in archive_specs
req.form never has a key 'type'. When achive() looks up 'type' in the form
dict  it causes a traceback rather than printing an error message.
2008-06-13 12:33:40 +02:00
Andrew Beekhof
e91a885fe8 webcommands: fix increments lost by 4858a155c4aa 2008-06-11 14:49:53 +02:00
Dirkjan Ochtman
cd5e863912 hgweb: show cset node and description when hovering over annotate prefix 2008-06-07 17:52:00 +02:00
Dirkjan Ochtman
d5bb71e5c9 merge from crew-stable 2008-05-29 22:23:33 +02:00
Benoit Boissinot
6b96c655db hgweb: correctly validate permissions with streamclone pulling 2008-05-26 14:20:26 +02:00
Patrick Mezard
56830b39f0 webcommands: pass full author to annotate, fix templates (issue 1054) 2008-04-23 22:45:53 +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
67493fd86d Merge from crew-stable. 2008-04-03 13:21:42 +02:00
Matt Mackall
cf71bb5f2b hgweb: fix merge breakage 2008-03-31 23:14:25 -05:00
Matt Mackall
1cca88367c hgweb: minor improvements for new web style
- make renamelink take a context
- pass current node to shortlog page rather than tip
- pass user/desc/date/rename to filediff
- improve template error reporting for foo%bar
2008-03-31 21:49:33 -05:00
Benoit Boissinot
2a79bac3c3 fix bug introduced by 3036384ac63a (thanks pychecker) 2008-03-30 22:29:02 +02:00
Benoit Boissinot
574729489c fix bug introduced by 4858a155c4aa (short not defined) 2008-03-30 22:22:53 +02:00
Benoit Boissinot
f193be73bd hgweb: remove dead code 2008-03-29 21:15:34 +01: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
Dirkjan Ochtman
d049a05886 hgweb: only accept POST requests for unbundle 2008-03-21 00:55:53 +01:00
Thomas Arendsen Hein
8064adc9b8 Spacing cleanup 2008-03-16 23:24:53 +01:00
Eric Hopper
0a50218866 Allow hgwebdir collections to follow symlinks. 2008-03-15 12:42:34 -07:00
Jesse Glick
40263dc4dd Issue937: error messages from hooks not sent over HTTP.
Turns out that stderr - where ui.warn would send messages - was not
being proxied over the HTTP connection. stdout was, and it seems you
need both. (The streams are interleaved for readability.)

Tested on Ubuntu 7.10 with lighttpd on hgweb.cgi with HTTP Basic auth,
no SSL, using a changeset failing win32text.forbidcrlf.
2008-02-25 09:55:57 -05:00
Stephen Deasey
b6ba89dcec hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
The error message at startup when the address/port could not be bound
was confusing:

    hg serve
    abort: cannot start server: Address already in use

Be more explicit:

    $ hg serve -a localhost
    abort: cannot start server at 'localhost:8000': Address already in use

Also be more explicit on success, showing hostname and ip address/port:

    $ hg -v serve -a localhost -p 80
    listening at http://localhost/ (127.0.0.1:80)


We are careful to handle a missconfigured machine whose hostname does not
resolve, falling back to the address given at the command line.

Remove a dead-code error message.
2008-03-10 19:25:34 +00:00
Florent Guillaume
c1858ea074 hgweb_mod: add branch helper functions to use in templates 2008-03-13 23:45:35 +01:00
Brendan Cully
e1863ee903 Support web.baseurl in hgwebdir, overriding SCRIPT_NAME 2008-03-08 17:19:18 -08:00
Joel Rosdahl
c26213193c Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg 2008-03-06 22:51:16 +01:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Thomas Arendsen Hein
deb94bc7fe Removed trailing spaces from everything except test output 2008-03-07 00:24:36 +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
9710ce5ef6 hgweb: no i18n in protocol responses 2008-02-21 15:56:35 +01:00
Dirkjan Ochtman
44000fbf43 improve changegroup.readbundle(), use it in hgweb 2008-02-21 17:02:28 +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
Michele Cella
095d8aff18 hgweb: fixes to make hg serve prefix handling more robust 2008-01-22 22:13:29 +01:00
Dirkjan Ochtman
cbeaa77a15 hgweb: forgot to centralize the req.write() calls in hgwebdir 2008-01-28 16:35:02 +01: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
Patrick Mezard
1c23ba81a1 webcommands: add missing hg import 2008-01-26 22:44:27 +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
a51e4d434d hgweb: revert to showing file instead of offering for download 2008-01-22 10:45:52 +01:00
Dirkjan Ochtman
54cd7309f5 hgweb: be sure to send a valid content-type for raw files 2008-01-22 12:31:55 +01:00
Dirkjan Ochtman
83100b06d2 hgweb: use ErrorResponse instead of custom response 2008-01-22 09:28:51 +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
Dirkjan Ochtman
0b45850058 hgweb: cleanup buglet introduced in 7ec4fd3d8731 2008-01-22 09:11:06 +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
e43716d86a hgweb: separate out start_response() calling 2008-01-18 19:53:38 +01:00
Dirkjan Ochtman
54b4ea87f1 hgweb: return iterable, add deprecation note 2008-01-18 19:53:38 +01:00
Dirkjan Ochtman
0d71615663 hgweb: remove some legacy code 2008-01-18 19:53:38 +01:00
Michele Cella
0e20a92c0f adding "prefix" option to "hg serve" (command line and [web] section)
allows "hg serve" to serve from a different path than '/' (server root)
2008-01-09 11:15:00 +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
Thomas Arendsen Hein
347da85c36 Removed tabs and trailing whitespace in python files 2007-12-29 19:49:48 +01:00
Mirko Friedenhagen
2a87bfec34 server: append to logfiles 2007-12-24 17:21:40 +01:00
Dirkjan Ochtman
e267ed3e21 hgwebdir: refactor inner loop 2007-12-03 19:19:12 +01:00
Dirkjan Ochtman
342d039d4e hgwebdir: split out templater creation 2007-12-03 18:58:18 +01:00
Dirkjan Ochtman
5cda3f99f4 hgwebdir: split out makeindex function, facilitate test failure diagnosis 2007-12-03 18:40:37 +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