Created
September 7, 2010 23:44
-
-
Save kylesluder/569344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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