Skip to content

Instantly share code, notes, and snippets.

@werm098
werm098 / svn_utils.sh
Last active July 28, 2017 15:17
Simple bash functions for working with SVN
function svnbranchname() {
svn info | grep "^Relative URL" | grep -oE "[^/]+$"
}
function svnmkbranch() {
if [ -z "$1" ]; then
echo "Error: Missing new branch name arg"
return
fi
local url=$(svn info | grep "^URL"); url=${url:5}
@werm098
werm098 / svn_log.sh
Created July 18, 2017 16:52
Simple bash function to log SVN commit messages for the day
function svnlog() {
local hoursAgo=12
if [ "$1" ]; then
hoursAgo=$1
fi
local dateThen=$(date -v-"$hoursAgo"H "+%Y-%m-%d %H:%M:%S")
local dateNow=$(date "+%Y-%m-%d %H:%M:%S")
echo "SVN LOG: $(date "+%Y-%m-%d")"
svn log --search "{{ SVN username }}" -r "{$dateThen}:{$dateNow}" {{ SVN URL }} \
| grep -v -e "| {{ SVN username }} |" -e "^br$" -e "^$" -e "-----"
@werm098
werm098 / svn_stash.sh
Last active August 2, 2017 13:03
Simple bash functions to simulate a git stash in SVN
function svnbranchname() {
svn info | grep "^Relative URL" | grep -oE "[^/]+$"
}
function svnstash() {
local branchName=$(svnbranchname)
if [ -n "$branchName" ]; then
if [ ! -d "../$branchName" ]; then
cp -Rv . ../$branchName
svn revert -R .