# to use: add these definitions to your .zprofile or appropriate 
# zsh dotfile

### USEFUL ZSH-SVN FUNCTIONS/ALIASES ###

# do a dry run of a merge to see what will happen
drymerge() { svn merge --dry-run "$@";}

# do a merge
merge() { svn merge "$@"; }

# blame and pipe to less
blame() { svn blame "$@"|less; }

# resolve conflicts
resolve() { svn resolved "$@";}

# switch working copy to URL: use with caution
switch() { svn switch "$@"; }

# run all appropriate quotient tests
testq() { trial -v quotient.test atop.test nevow.test; }

# list URL
sls() { svn ls "$@"; }

# info on working-copy
sinfo() { svn info "$@"; }

# show log related to URL (defaults to working copy)
slog() { svn log "$@"|less; }

# VERY USEFUL: like above, but when viewing branch this
# command only shows from current revision --> revision when 
# branch was created
slogcp() { svn log -v --stop-on-copy "$@" |less; }

# alias for svn commit
sci() {svn ci "$@";}

# alias for svn checkout
sco() {svn co "$@";}

# revert arg
srevert() { svn revert "$@"; }

# revert recursively
sRevert() { svn revert -R "$@";}

# diff arg and pipe to less
sdiff() { svn diff "$@"|less; }

# i have my PYTHONPATH set to /home/slyphon/Projects/Quotient/working
# which is a symlink to whatever branch i'm working on. When I want to 
# change what branch python is going to consider 'quotient', I cd to
# to that dir and run the following command:
svnchwc() {             # svn-change-working-copy
    origdir=`pwd`
    cd $HOME/Projects/Quotient;
    if [[ -h './working' ]]; then
        echo 'changing symlink'
        rm working
        ln -s $origdir working
        ls -la .
    fi
    cd $origdir;
}

# i found this to be useful, as i'm typing this quite frequently before a 
# an 'svn status' command

# remove pyc's in current directory tree
rmpyc() { find . -name '*.pyc'|xargs rm }

# 

#### URL ENVIRONMENT VARIABLES ####

# the things that suck the most about svn commands are 
# the ludicrously-verbose URLs, so I made some environment
# variables pointing to frequently-typed values

export dqrepo=svn+ssh://divmod.org/svn/DeployQuotient

export repo=svn+ssh://divmod.org/svn/Quotient
export exarbr=$repo/branches/exarkun
export amirbr=$repo/branches/amir
export trunk=$repo/trunk
export branches=$repo/branches
export erin=$branches/erin
export dpbr=$branches/dp
export slybr=$branches/slyphon
export washbr=$branches/washort
export exarbr=$branches/exarkun
export amirbr=$branches/amir
export glyphbr=$branches/glyph

# slightly temporary friendly branch names
# canonical names for branches i'm working on, 
# adjust to taste
export extractbr=$slybr/issue433

