[PATCH 0 of 3] Cloning to hgwebdir collection

Martin Vejnar avakar at ratatanek.cz
Fri Sep 25 14:01:16 UTC 2009


Hi,

this is a series of patches to add the ability to clone local repos to a
hgwebdir-served repo collection, i.e. the ability to create new remote
repos.

The feature would be beneficial to users (like me) that often create new
small repositories and would like to clone them to the web. Without the
need to invoke ssh there would be only one URL for both cloning and
pushing, making it easier for novices to start working with mercurial,
and less cumbersome for everyone. With the additional ability to rename
(or even delete) repositories through the web interface, it might
eventually remove the need for separate ssh access completely.

To achieve the goal, I simply added the support for an additional
command to create a new empty repo. This mirrors the way other
(non-local) ssh clones are performed, i.e. with init and push steps
separate. The command is intercepted by hgwebdir_mod (i.e. it is not
passed to hgweb_mod like all the other commands).

The 'hg clone' command now accepts --contact and --description
parameters, whose values are sent along with the remote init command.
This allows the user to set the description and contact information
displayed in the web interface.

I've added two new configurations options -- web.allow_init and
web.deny_init -- that work the same as allow_push/deny_push. The user
needs both init and push permissions to create a new repository (this
ensures that the close doesn't fail mid-operation due to authorization
failures).

The filepath of the new repository is determined from the URL by
scanning through the [collections] section config items. If there are
any [paths] section items the creation will fail. Without ** wildcards,
it should be possible to determine the real path, but I've decided to
defer that to later patches, if the need should arise. I'm assuming that
users that would benefit from http cloning will probably have their
hgwebdir configured with [collections] anyway.

The patches can be applied against the main 'hg' repository.

This is my first patch submission, I beg your indulgence if I've missed
something or done something wrong.

Best regards,
-- 
Martin


More information about the Mercurial-devel mailing list