Commit Graph

452 Commits

Author SHA1 Message Date
Thomas Arendsen Hein
baf6470a7a merge with crew-stable 2009-11-22 11:27:29 +01:00
Thomas Arendsen Hein
51b9419544 Do not overwrite motd attribute of hgwebdir instances on refresh.
This allows using
application = hgwebdir(...)
application.motd = (string or object with __str__ method)
in WSGI (like it is possible in CGI).

Changed web.motd in the config file is still read with this, because
hgwebdir.templater.motd() does not store the config value.
2009-11-22 11:25:01 +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
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
Dirkjan Ochtman
cc8f0501e9 hgweb: keep original order from hgwebdir config files (issue1535) 2009-11-05 15:06:35 +01:00
Dirkjan Ochtman
ae12866ae1 hgweb: use a tuple-list instead of dictionary for append-only store 2009-11-05 15:01:00 +01:00
Dirkjan Ochtman
d1740999b1 hgweb/sshserver: extract capabilities for easier modification 2009-11-05 11:07:01 +01:00
Sune Foldager
ee001cdc90 hgweb: send proper error messages to the client
Fixes a bug in protocol which caused an exception during exception handling in
some cases on Windows. Also makes sure the server error message is correctly
propagated to the client, instead of being thrown away.
2009-11-02 10:20:04 +01:00
Martin Geisler
7852b670d0 Merge with crew-stable 2009-08-27 00:01:03 +02:00
Dirkjan Ochtman
845db1fb2d hgweb: show diff header line in raw diffs 2009-08-26 14:58:09 +02:00
Dirkjan Ochtman
d96058fd14 hgweb: add web.descend configuration variable 2009-08-19 12:47:04 +02:00
Bryan O'Sullivan
9a780e99c8 Fix issue1679: path reconstruction in hgwebdir was mangling things badly 2009-07-22 15:26:27 -07:00
Bryan O'Sullivan
2f16501cf7 Merge with crew-stable 2009-07-22 15:28:30 -07:00
Martin Geisler
ae0794fd45 coding style: use a space after comma
I left a cases like 'lambda x,y:' alone -- the lack of a space does
not bother me as much when the variables are single letters.
2009-07-22 23:12:54 +02:00
Nicolas Dumazet
7eadbe8d42 for calls expecting bool args, pass bool instead of int
str.splitlines and email.message.as_string both expect a bool argument
defaulting at False: replace f(1) by f(True) and f(0) by f()
2009-07-13 09:50:26 +09:00
Alejandro Santos
5eb00dc7df compat: remove unnecessary diamond-shaped multiple inheritance 2009-07-05 11:06:41 +02:00
Alejandro Santos
77d606ac51 compat: use open() instead of file() everywhere 2009-07-05 11:01:30 +02: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
Henrik Stuart
b843569ec5 acl: support for getting authenticated user from web server (issue298)
Previously, the acl extension just read the current system user, which
is fine for direct file system access and SSH, but will not work for
HTTP(S) as that would return the web server process user identity
rather than the authenticated user. An empty user is returned if the
user is not authenticated.
2009-06-07 20:31:38 +02:00
Henrik Stuart
45e3728174 hgweb: escape REMOTE_HOST when passing url for addchangegroup
If DNS lookups are turned off on the web server, REMOTE_HOST may be
populated with REMOTE_ADDR, which, if the remote is an IPv6 hosts will
contain colons, thus interfering with the separator character. This is
solved by URL quoting the REMOTE_HOST string.
2009-06-07 20:15:37 +02:00
Peter Arrenbrecht
fd55ac9c4d graphmod/webcommands: use generic DAG walks
Changes graph() to colorededges(), which operates on the new
generic DAG walks and adds color and edge information needed
by the web graph.

This is in preparation of adding DAG walk filters, like the
linear run collapser in the next patch. The idea is to have
a bunch of changelog walkers that return basic data. Then we
can filter this data. Finally we add edge and formatting info
suitable for the output media we want to target (glog, hgweb).
2009-06-19 13:44:23 +02:00
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
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