Remote repository creation [was Re: Your favorite bug]
Jorge Vargas
jorge.vargas at gmail.com
Thu Mar 12 03:18:28 CDT 2009
On Mon, Mar 2, 2009 at 7:27 AM, Paul Crowley <paul at lshift.net> wrote:
> Antoine Pitrou wrote:
>> Matt Mackall <mpm <at> selenic.com> writes:
>>>> It's too late for the feature freeze, but I'd like to suggest remote
>> repository
>>>> creation (with ssh://...
>>> hg init ssh://foo
>>
>> How can I have thought this didn't exist? Well, sorry for the noise then :-S
>
> Or "hg clone . ssh://foo/foo" (which does an init followed by a push).
> This is supported by mercurial-server.
I have been thinking this over and even though I eventually figured
that one out.
I think we still need a way to automate this better, specially if you
don't want to give SSH access to people for creating repo.
Ideally I'll like to see something like
hg init http://mysite.com/hg
<ask for auth>
<ask for default values to populate the hgrc>
I wrote a python script that does part of this, but I'm missing the hg
intregration and it needs to be run from inside the host.
I'll love it if someone could point me in the right direction, should
I submit a patch? should I release this as an extension? code reviews
are also welcome.
hg_ini="""
[web]
allow_push = %(allow_push)s
contact = %(contact)s
description = %(description)s
allow_archive = gz zip bz2
push_ssl = False
"""
#http://www.selenic.com/mercurial/wiki/index.cgi/MercurialApi
from mercurial import commands
from mercurial import ui
from mercurial import hg
def create_repo(repo_name,allow_push,contact,description):
local_ui = ui.ui()
#XXX why this doesn't returns the repo?
commands.init(local_ui,repo_name)
dest_repo = hg.repository(local_ui, repo_name)
fp = dest_repo.opener("hgrc", "w", text=True)
fp.write(hg_ini % locals())
fp.close()
More information about the Mercurial
mailing list