forked from myhirra/shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsbn
More file actions
executable file
·33 lines (30 loc) · 881 Bytes
/
sbn
File metadata and controls
executable file
·33 lines (30 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
#操作类型
# cp 复制当前work目录下所有改动 到指定目录
# add 当前work目录下对所有新加文件执行`svn add`
# del 当前work目录下对所有删除文件执行`svn del`
#check
type sbn >/dev/null 2>&1 || {
PWD=$(pwd)
ln -s $PWD/sbn /usr/local/bin/sbn
echo >&2 "Install complete! please enjoy it.";
exit 1;
}
#操作名
ME=$1
#目标路径
PA=$2
case "$ME" in
cp)
if [ ! -z PA ]; then
svn st | awk '{ if($2 != "." && ($1 == "M" || $1 == "A")){ if($2 == "+"){ print $3 }else{ print $2 } } }' | xargs -n1 -I {} cp -rf {} $PA{}
svn st | awk '{ if($1 == "D"){print $2} }' | xargs -n1 -I {} svn del $PA{}
fi
;;
add)
svn st | awk '{ if($1 == "?"){print $2} }' | xargs svn add
;;
del)
svn st | awk '{ if($1 == "!"){print $2} }' | xargs svn del
;;
esac