[darcs-users] Pushing to an FTP location

Peter Lund firefly at diku.dk
Sat Jul 29 11:21:17 UTC 2006

On Sat, 2006-07-29 at 11:18 +0200, Eric Y. Kow wrote:

> Perhaps a rough sketch of an idea would be based on having a local
> mirror of the remote repository.  A remote apply would then
> go a little like this:
> 1) Lock the remote repository
> 2) Update the mirror (pull)
> 3) Do darcs apply, but at the same time, log all the files that
>    are modified by darcs, even/especially stuff in _darcs.  
>    It might help to distinguish between deleted and added/updated
>    files.  Note that mv would probably have to be recorded as
>    remove-and-add.
> 4) Using the log, update all the relevant files on the remote
>    end.  In your case, this would consist of asking ftp to
>    delete and upload stuff.
> 5) Unlock the remote repository
> Anybody have any other (hopefully simpler, more elegant) ideas?

I have a (small) remote repository at http://vax64.dk/bælg/ and my
hoster only allows writes via ftp (with passwords in the clear, off
course).  The above is more or less how I push to that repository.

I tried something similar to what Vyacheslaw did at first, only with
FUSE and curlftpfs (I'm running Linux whereas Vyacheslaw is probably
running Windows).  It was buggy /and/ it didn't understand file locking.
Every time darcs tried to lock a file it would return an error.

So now I use the attached script instead and it works perfectly.  The
script only runs under Unix/Linux (or within cygwin) but something
similar could easily be written for ordinary windows environments.  I
use one of gnomevfs utilities for the copying, I bet there are similar
kioslave utilities one could use instead.  And then there is lftp (a
command-line FTP client) which would also work fine.

My current script pretty much does what you suggest above, except:
1) there is no locking
2) everything gets copied down
3) there is no log
4) everything gets copied back (there is no log)
5) there is no unlocking

As long as my repository is small it is a fine solution.

When my repository gets bigger I'll look at optimizing it a bit.  I'm
not going to keep a log, since it is easy to compare two directories to
see which files are new/changed.  Sticking to one directory and
comparing timestamps is also easy.

I could also keep the "mirror" around between invocations of the script
and just assume that nobody else changes it.  Or I could use FTP to list
the files in _darcs/* and see if they are any new files or any with a
changed size or timestamp.  I might even use an HTTP connection and HEAD
requests to help (using the ETag) but that is probably overkill.

All in all, I think small, incremental refinements of the darcspush
script could get me a long way.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: darcspush
Type: application/x-shellscript
Size: 288 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20060729/b60a8077/attachment.bin 

More information about the darcs-users mailing list