32ce85aa2375cd8e4b7565264cb64b64b0512db8
[feisty_meow.git] / scripts / rev_control / svnapply.sh
1 #!/bin/bash
2 #
3 # Applies arbitrary commands to any svn status.
4 #
5 # For example, this shows any files that are in the working folder but are not part of the svn repository:
6 #    svnapply \? echo
7 #
8 # This deletes all files that are not checked into svn (escape the ? from the shell):
9 #    svnapply \? rm
10 #
11 # List all conflicted files:
12 #    svnapply C ls -l
13 #
14 # found on web at:
15 # http://stackoverflow.com/questions/160104/how-do-you-add-all-untracked-files-in-svn-something-like-git-add-i
16 #
17
18 PATTERN="$1"; shift
19
20 svn st | egrep "^\\${PATTERN}[ ]+" | \
21   sed -e "s|^\\${PATTERN}[ ]*||" | \
22   sed -e "s|\\\\|/|g" | \
23   xargs -i "$@" '{}'
24