Geek Noise
Rants, rambles, news and notes by Peter Provost
15

Another Cool PowerShell + Subversion Hack

Tuesday, 15 August 2006 13:22 by Peter Provost

As I said before, I’ve been writing an Addon for World of Warcraft using the Ace2 libraries which are hosted on a subversion server.

I was trying to track down a bug that I couldn’t reproduce so I decided to completely refresh my entire Ace addon set from the svn server.

So I needed to run through every directory in my Addons folder and if it was a subversion working copy then I wanted to delete it and re-checkout that folder from the subversion server.

Again, this only took a single line of PowerShell script:

[75] » ls | ? { svn st $_ 2> out-null; return ($lastexitcode -eq 0) } | % { 
$xml = [xml] (svn info --xml $_ 2> out-null); $url = $xml.info.entry.url; 
del -recu -force $_; svn checkout $url $_ }

I love PowerShell. It rocks!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
25

My newest interesting Powershell script

Tuesday, 25 July 2006 06:20 by Peter Provost

I’ve started running a bunch of Ace Addons for World of Warcraft and I love the fact that they have them all up on their Subversion server. But it was getting annoying having to do “svn update” on each and every folder (using TortoiseSVN wasn’t any better… I then had to right-click each one… not better).

But of course, being the Powershell junkie that I am, I had to automate this, so here’s what I just ran. I know it can be simplified a bit, but this works for now:

PS > gci | where { $_.GetType().FullName -eq "System.IO.DirectoryInfo" } | foreach { cd $_; svn update }

Woo hoo!

Update: I suppose I should have just tried using SVN for this first, eh? It turns out "svn update *" works just fine.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5