Created
June 28, 2013 23:29
-
-
Save mashurex/5888924 to your computer and use it in GitHub Desktop.
Subversion blame history output script
This file contains hidden or 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
#!/bin/bash | |
####### | |
# | |
# SVN Blame Writer | |
# Author: Mustafa Ashurex | |
# Description: Automatically outputs svn blame to a history file and/or screen for reading. | |
# | |
####### | |
function print_help { | |
echo "usage: blame [filename | -h] [-n]" | |
echo "-h : Print this menu" | |
echo "-n : Do not write a history file" | |
} | |
if [ "$1" == "-h" ]; then | |
print_help | |
exit 0 | |
fi | |
if [ ! -f "$1" ]; then | |
print_help | |
echo "ERROR: Not a valid file." | |
exit 1; | |
fi | |
if [ $# -gt 1 ]; then | |
if [ "$2" != "-n" ]; then | |
svn blame $1 > $2 | |
else | |
svn blame $1 | |
fi | |
elif [ $# -eq 1 ]; then | |
svn blame $1 > "$1.history" | |
cat "$1.history" | |
else | |
print_help | |
echo "ERROR: Must specify a file to review." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment