701f4a931bb6873408ffd3311aaf9457

For those who work with subversion, here is a little interface to subversion status command. I've made it to facilitate my svn operation on files, because sometimes when you do a "svn st" command and there is many files with a common status you would want to play with it, it is easier to use that kind of command. You can read a small article on my blog about how to use it (http://philrathe.com/2007/11/27/svndo-to-do-less-svn-typing/).

Thanks Marc-André for your help on this.

Happy hacking!

1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/ruby -w

status, *cmd = ARGV

`svn st`.each do |line|
  if matches = /^#{Regexp.escape(status)}\s+(.*)$/.match(line)
    tmp = cmd.map {|c| c.gsub(/\$/,matches[1])}
    tmp << matches[1] if tmp == cmd
    puts tmp.join(' ')
  end
end

Refactorings

No refactoring yet !

2155c92be66863c4634778bf522efe14

armandino.myopenid.com

December 18, 2007, December 18, 2007 07:06, permalink

1 rating. Login to rate!

That's a handy script Philippe!

I used to do batch operations using xargs but this is a lot simpler and cleaner. Good idea! :)

'svn add' all new files

1
2
svn st | grep ? | sed -e 's/?//g' | xargs svn add
701f4a931bb6873408ffd3311aaf9457

philippe.rathe.myopenid.com

December 18, 2007, December 18, 2007 13:43, permalink

No rating. Login to rate!

Hey thanks for your reply. Using xargs may be a good thing if using bash for that kind of script was a good idea, though it would be much less cleaner as you said. But I'm very careful doing batch operations on my repository and showing an output of what the command will do when piping to a shell interpreter makes me feel more confident.

Happy that you've liked it.

Your refactoring





Format Copy from initial code

or Cancel