Question

I have a few different darcs repos and I would like to write a script to automatically push changes from these repos at the end of the day. I read at this thread that the "right" way to script darcs is using the library. But here http://darcs.net/Library it says that "it is very much a work in progress" and lacks a stable API. What is the "right" way to script darcs.

Was it helpful?

Solution

It's perfectly fine to script everyday darcs commands, like any other command-line program. It's also fine to script interactive darcs commands, but that's where it gets fragile, because those interactive prompts get refined and changed quite often in new darcs releases. So if at all possible, make the command non-interactive, eg using the -a/--all flag. Push and pull is easy, here's a regular pull that I run from /etc/crontab:

*/15 * * * * darcsden  cd /home/darcsden/darcs/darcs-reviewed; darcs pull -a http://darcs.net/reviewed >/dev/null # 2>&1

but watch out for things that can prevent a successful non-interactive push or pull:

  • conflicts, especially with unrecorded changes
  • wrong user/file ownership/file permissions
  • stray _darcs/lock file left over from an abnormal termination
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top