Sync your code on SVN to a webserver

Manu had asked me yesterday if I knew some way to get the latest or working files from the google code svn repo and somehow push it to some webserver so that people will be able to see the latest code up and running. I was looking for some way to do that and found a really nice class called phpsvnclient(http://code.google.com/p/phpsvnclient/). phpsvnclient is pretty straight forward; give it a repo url with optional login credentials, and you are ready to go. All you need to do next is to give it a folder name and then ask it to either get files or the whole directory as a raw dump or an xml file and much more like revision et al..

I wrote a php script that lets you specify a url and a folder, along with filters for the files you want to get; and then downloads and stores the files in the folder to your local(server) directory. Files are only downloaded if new revisions are found.

The initial need came from a project that me, manu and kinshuk were working on, then when I put t-racks on Google Code yesterday, I kinda needed the same. In the adminSource section of your google code project, you will find a field,under the Post-Commit web hooks section, where you can add a url to do a Post-Commit HTTP POST requests. You have some tokens you can add to the url, or you can use it just as it is. I didn’t get it to work the first time and decided to setup a cron job on my server instead, which worked like a charm.

Now that I think about it, this was something we were looking for in our Drupal projects as well lol!! :P maybe I’ll test it out at work too. The limitation of the script right now is that it checks for a revision and does not do anything to check if each file was actually updated, it just downloads the whole lot. This possibly will be really bad if your repo has like 4000 files :D

View code here

Download code here – this also contains the version of phpsvnclient I used.

  • Print
  • email
  • PDF
  • Twitter
  • Identi.ca
  • Google Bookmarks
  • Digg
  • del.icio.us
  • StumbleUpon
  • Ping.fm
  • Facebook
  • DZone
  • FriendFeed
  • Reddit
  • Technorati

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">