Permalink
Browse files

Add new command, svn-null

svn-null is similar to git-null but for Subversion.
  • Loading branch information...
1 parent de629bc commit 8b6b2c4afb35098f17064860c01a07a755becf53 @rosslagerwall committed Aug 10, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 svn-null
View
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+cleanup() {
+ rm "$svn_out"
+ rm "$svn_err"
+}
+
+svn_out=$(mktemp)
+svn_err=$(mktemp)
+
+svn status --no-ignore > "$svn_out" 2> "$svn_err"
+
+if [ -s "$svn_err" ]; then
+ echo "svn error:"
+ cat "$svn_err"
+ cleanup
+ exit 1
+fi
+
+if [ -s "$svn_out" ]; then
+ echo "Checkout is not clean!"
+ cleanup
+ exit 1
+fi
+
+if [ "$1" = "-f" ]; then
+ echo "Updating `pwd` to the *null* revision."
+ find . ! -path './.svn*' -delete
+ echo "To go back to the previous state, run: svn revert -R ."
+else
+ echo "usage: $0 -f"
+fi

0 comments on commit 8b6b2c4

Please sign in to comment.