Skip to content

Instantly share code, notes, and snippets.

@mashurex
Created June 28, 2013 23:29
Show Gist options
  • Save mashurex/5888924 to your computer and use it in GitHub Desktop.
Save mashurex/5888924 to your computer and use it in GitHub Desktop.
Subversion blame history output script
#!/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