File tree 1 file changed +34
-11
lines changed
1 file changed +34
-11
lines changed Original file line number Diff line number Diff line change 7
7
#
8
8
# @author Jerry Lee
9
9
10
+ colorEcho () {
11
+ local color=$1
12
+ shift
13
+ if [ -c /dev/stdout ] ; then
14
+ # if stdout is console, turn on color output.
15
+ echo -ne " \033[1;${color} m"
16
+ echo -n " $@ "
17
+ echo -e " \033[0m"
18
+ else
19
+ echo " $@ "
20
+ fi
21
+ }
22
+
23
+ redEcho () {
24
+ colorEcho 31 " $@ "
25
+ }
26
+
27
+ greenEcho () {
28
+ colorEcho 32 " $@ "
29
+ }
30
+
10
31
[ $# -eq 0 ] && dirs=(.) || dirs=(" $@ " )
11
32
12
33
for d in " ${dirs[@]} " ; do
13
- [ ! -d ${d} /.svn ] && {
14
- echo " $d is not svn work dir!"
15
- continue
16
- }
17
- (
18
- cd " $d "
19
- branches=` svn info | grep ' ^URL' | awk ' {print $2}' `
20
- trunk=` echo $branches | awk -F' /branches/' ' {print $1}' ` /trunk
21
- svn sw " $trunk "
22
- echo " svn work dir $d switch from ${branches} to ${trunk} ."
23
- )
34
+ [ ! -d ${d} /.svn ] && {
35
+ redEcho " directory $d is not a svn work directory, ignore directory $d !"
36
+ continue
37
+ }
38
+ (
39
+ cd " $d " &&
40
+ branches=` svn info | grep ' ^URL' | awk ' {print $2}' ` &&
41
+ trunk=` echo $branches | awk -F' /branches/' ' {print $1}' ` /trunk &&
42
+
43
+ svn sw " $trunk " &&
44
+ greenEcho " svn work directory $d switch from ${branches} to ${trunk} ." ||
45
+ redEcho " fail to switch $d to trunk!"
46
+ )
24
47
done
You can’t perform that action at this time.
0 commit comments