Created
March 11, 2015 10:10
-
-
Save allex/1669add07baad6a4d627 to your computer and use it in GitHub Desktop.
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/sh | |
# svn utils | |
# Author: Allex Wang ([email protected]) | |
# GistID: | |
dir=`pwd` | |
source=$dir | |
cmd=$1 | |
name=$2 | |
SVN_BASE_MAN="http://svn.bubugao.com/svn/bbg-code/ued/project/static5" | |
SVN_BASE_BRA="http://svn.bubugao.com/svn/bbg-code/ued/branches/project/static5" | |
SVN_BASE_TAG="http://svn.bubugao.com/svn/bbg-code/ued/tag/project/static5" | |
svn_ls() { | |
svn ls $1; | |
echo "SVN URL: $1"; | |
} | |
url="" | |
co_master=0 | |
case $cmd in | |
master | trunk) | |
url=$SVN_BASE_MAN | |
co_master=1 ;; | |
br | branche) | |
url=$SVN_BASE_BRA ;; | |
tag) | |
url=$SVN_BASE_TAG ;; | |
lg) | |
cd $source; svn log -l 10; | |
exit ;; | |
u | url) | |
url=`cd $source; svn info .| awk '/^URL:/{print $2}'` | |
echo $url | |
exit 0 ;; | |
v | ver | version) | |
ver=`cd $source; svn info .| awk '/^Revision:/{print $2}'` | |
echo $ver | |
exit 0 ;; | |
*) | |
svn "$@" | |
exit ;; | |
esac | |
[ $co_master -eq 1 ] || [ "${name}x" != "x" ] || { svn_ls $url; exit 0; } | |
if [ ! -d $source/.svn ]; then | |
echo >&2 "$source is not a working copy." | |
exit 1; | |
fi | |
cd $source | |
url="${url}/${name}" | |
echo "Switch svn to $url ..." | |
svn sw $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment