Skip to content

Instantly share code, notes, and snippets.

@kylesluder
Created September 7, 2010 23:44
Show Gist options
  • Save kylesluder/569344 to your computer and use it in GitHub Desktop.
Save kylesluder/569344 to your computer and use it in GitHub Desktop.
shelve () {
local filename=${1:-shelf.patch}
if [[ -a $filename ]]; then
echo 1>&2 shelve: file "'$filename'" already exists
return 256
fi
svn diff | tee $filename | wc -l | read linecount && svn revert -R .
if [[ $linecount -eq 0 ]]; then
echo 1>&2 shelve: no changes to shelve
rm $filename
fi
}
unshelve () {
local filename=${1:-shelf.patch}
if [[ ! -r $filename ]]; then
echo 1>&2 unshelve: file "'$filename'" not found
return 256
fi
patch -p0 < $filename && rm $filename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment