Remote repository creation [was Re: Your favorite bug]

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Thu Mar 12 04:44:23 CDT 2009


On Thu, Mar 12, 2009 at 9:18 AM, Jorge Vargas <jorge.vargas at gmail.com> wrote:
> 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()

So here's the link to my earlier and non-maintained attempt:

http://freehg.org/u/parren/rexec/

-parren



More information about the Mercurial mailing list