13

6

My company is evaluating Kiln (hosted) and one requirement is to back up all repositories locally.

Previously, Stefan wrote a backup script which you can find here. However, that script hasn’t been updated to use the new "token" API, stores passwords in plaintext, and has some other shortcomings.

I’ve written a new backup script that you can find here:

It uses the Kiln API to get a list of all available repositories from your account. It then backs up each one, using the “clone” command (for the initial backup) or the “pull” command (for subsequent backups).

Some features are:

  • Correctly handles repositories with Unicode characters in their name.
  • Uses KilnAuth, so it does not need to store passwords.
  • Uses the new (required) "token" API.
  • Tested on Windows, Mac OS X, Linux.
  • Stores repositories in a directory hierarchy that mirrors your project/group/repo hierarchy on Kiln.
  • Tries to continue backing up even if a repository fails, so you don’t miss the rest of your backup if one repo has a problem.
  • Nice status messages that can be turned off using the --quiet command-line option.

The script should be considered experimental, but I think some Kiln users may want to try it out.

Update 2010-06-07: New features added:

  • Back up only part of your Kiln account by using the --limit command-line option. (This could make the script usable with Web Hooks, although this isn’t tested yet. I haven’t written the web component, which would be a PHP or ASP.NET page that runs the backup script.)
  • Update a working copy using the --update command-line option.
flag
.......Awesome! – Ben Kamens May 27 2010 at 23:11
Excellent -- thanks for sharing this script! – Ken Morse Aug 27 2010 at 11:47

1 Answer

3

Thanks for writing this, Nate! This looks awesome. The next step would probably be to wire it up to Kiln's webhooks so that it pulls whenever you push, rather than polling intermittently. Would you be interested in accepting patches to add that functionality (probably as a separate module)?

link|flag
I’m not familiar with how Kiln webhooks work but that sounds like a good idea. I’d gladly take patches. – Nate May 27 2010 at 4:15
I’ve added a --limit command-line option that should make the script much more useful with webhooks. You can back up just one project, group, or repository. So now I just need to write, or get someone to write, a PHP and ASP.NET script that receives the web hook and kicks off the backup script. – Nate Jun 7 2010 at 21:37

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.