[darcs-users] Setting up a sendable repository using PHP

James Dean Palmer james at tiger3k.com
Wed Nov 10 04:22:48 UTC 2004

I thought I would share a very simple PHP script I wrote that can be
used to accept patches for a repository.

-- begin post.php --

// Path to darcs if darcs is not in the path.
$darcs = "darcs";

// Where reply messages should be sent.
$reply = "--reply user at host.com";

// Path to the repository.  (Current directory by default).
$repository = escapeshellarg(getcwd());

// Verify against allowed keys.
// $verify = "--verify /path/to/the/allowed_keys";
$verify = "";

if ($HTTP_POST_FILES['patch']['name']) {
  if ($HTTP_POST_FILES['patch']['size'] > 0) {
    $cmd = "$darcs apply $reply $verify --no-resolve-conflicts " .
      " --repodir " . $repository . " " .

-- end post.php --

This is meant to be a web based alternative to the procmail recipe in
the "Getting Started" section of the manual.

To send a patch to the repository, use something like:

$ darcs send -o __PATCH http://host.com/path/to/repo
$ curl -F patch=@__PATCH http://host.com/path/to/repo/post.php 

Not only can you use gpg to sign patches destined for the repository as
described in the manual, but you can obviously use web based security to
make post.php password protected and you can use https.


More information about the darcs-users mailing list