Commit Graph

431 Commits

Author SHA1 Message Date
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
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