[darcs-devel] Re: "darcs push" over HTTP POST via libcurl

David Roundy droundy at darcs.net
Fri Dec 23 08:06:38 PST 2005


On Fri, Dec 23, 2005 at 12:42:50AM -0800, Adam Megacz wrote:
> So, somehow doing this over thanksgiving break turned into doing it at
> the start of winter break... oh well...

I know how that can be...

> Following this email you should get a patch bundle with "all the
> necessary parts"; I tried it and it works fine.  However, internally
> the organization probably isn't what you want -- basically I just
> hacked things into the first place they would fit.  Anyways, I was
> hoping you could give me a bit of guidance since I don't know my way
> around darcs innards that well.
> 
> If you feel this discussion should take place on the mailing list, go
> ahead and reply there (cc me though since I only read the list every
> few days).

(So please everyone, keep Adam cc'ed, and myself too, if you want me to
hear your comments.)

> What do you think about automatically distinguishing between an email
> address and a URL?  I'm pretty certain no string is both a valid URL
> and a valid email address, so we ought to be able to figure out what
> the user means simply by using a URL-parser (I'm sure there's one in
> hslibs somewhere...).

That makes sense to me.  I don't know that we need a 100% reliable way of
distinguishing http URLs from email addresses.  I suppose "@" is allowed in
an http URL, so the easiest thing to do would be to disallow email
addresses beginning with http://.  In any case, if there are people with
such an email address, I'm sure they'll contribute code to disambiguate
this...

> Right now, if I'm not mistaken, things work like this unless you
> override things using command-line arguments (in which case darcs does
> exactly what you tell it):
> 
>   command:   repository is:      darcs will:
>   --------  ------------------  ---------------------------
>    send      local               transmit a patchbundle via SMTP
>    send      remote via ssh      transmit a patchbundle via SMTP
>    send      remote via http     transmit a patchbundle via SMTP
> 
>    push      local               manipulate the target files
>    push      remote via ssh      transmit a patchbundle to another darcs via ssh
>    push      remote via http     transmit a patchbundle via SMTP
> 
> I'm proposing to change the last one to "transmit a patchbundle via
> HTTP POST".  The former behavior still exists as "darcs send" (which
> is no longer redundant).

Actually, the last line is currently "complain that DARCS_APPLY_HTTP isn't
defined in the environment".  Changing it to a post command sounds
reasonable, but I'm afraid it would give confusing error messages to people
who accidentally push to an http server.  e.g. I push to darcs.net using
ssh, but sometimes pull using http, and if I then tried to push I'd get
some sort of error message.

I'm sure that *I'd* figure it out, but am afraid that a new darcs user
would try to use push when they should be using send, and get confused.  I
don't know.  Perhaps what we need is a "post-to" file on the server, which
would give a default post location.  So if you pull from

http://abridgegame.org/repos/darcs

and then try to push, darcs would read the file

http://abridgegame.org/repos/darcs/_darcs/prefs/post-to

and if it contains a valid URL, darcs would http post to that URL.  Then if
there is no such file, darcs would exit with an error message stating that
the target repository isn't set up to recieve pushes via http, and that the
user could either set the DARCS_APPLY_HTTP environment variable, or could
perhaps use darcs send to send by email (perhaps first checking whether
there is a repo email address in prefs).

This way the repo owner wouldn't have to make the post script also work for
pulling, which would be a nice (but small) gain.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list