new script for running commands against code in a particular state in svn.
authorFred T. Hamster <fred@gruntose.com>
Mon, 2 Apr 2012 17:40:23 +0000 (13:40 -0400)
committerFred T. Hamster <fred@gruntose.com>
Mon, 2 Apr 2012 17:40:23 +0000 (13:40 -0400)
a handy one is: "svnapply.sh \? echo"
which shows all the un-checked in files.

scripts/rev_control/svnapply.sh [new file with mode: 0644]

diff --git a/scripts/rev_control/svnapply.sh b/scripts/rev_control/svnapply.sh
new file mode 100644 (file)
index 0000000..040675c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Applies arbitrary commands to any svn status. e.g.
+#
+# Delete all non-svn files (escape the ? from the shell):
+# svnapply \? rm
+#
+# List all conflicted files:
+# svnapply C ls -l
+#
+# found on web at: http://stackoverflow.com/questions/160104/how-do-you-add-all-untracked-files-in-svn-something-like-git-add-i
+#
+
+PATTERN="$1"; shift
+
+svn st | egrep "^\\${PATTERN}[ ]+" | \
+  sed -e "s|^\\${PATTERN}[ ]*||" | \
+  sed -e "s|\\\\|/|g" | \
+  xargs -i "$@" '{}'
+