new script for running commands against code in a particular state in svn.
[feisty_meow.git] / scripts / rev_control / svnapply.sh
1 #!/bin/bash
2 #
3 # Applies arbitrary commands to any svn status. e.g.
4 #
5 # Delete all non-svn files (escape the ? from the shell):
6 # svnapply \? rm
7 #
8 # List all conflicted files:
9 # svnapply C ls -l
10 #
11 # found on web at: http://stackoverflow.com/questions/160104/how-do-you-add-all-untracked-files-in-svn-something-like-git-add-i
12 #
13
14 PATTERN="$1"; shift
15
16 svn st | egrep "^\\${PATTERN}[ ]+" | \
17   sed -e "s|^\\${PATTERN}[ ]*||" | \
18   sed -e "s|\\\\|/|g" | \
19   xargs -i "$@" '{}'
20