-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.bash_profile__svn
More file actions
33 lines (28 loc) · 831 Bytes
/
.bash_profile__svn
File metadata and controls
33 lines (28 loc) · 831 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
###########
### SVN ###
###########
# get the current branch name
function __svn__branch_name {
url=$(svn info | grep "^URL" | awk '{print $NF}')
repository_root=$(svn info | grep "^Repository Root" | awk '{print $NF}')
# relative_url
echo "${url/$repository_root/^}"
}
function __svn__untracked_files {
new_files=$(svn status | grep "?" | awk '{print $NF}')
echo $new_files
}
# check & get the formatted branch name
function __svn__dirty {
status=$(svn status 2> /dev/null | tail -n 1)
if [[ $status != "" ]]; then
echo $COLOR_MAGENTA$(__svn__branch_name)$COLOR_YELLOW
else
echo $(__svn__branch_name)
fi
}
# compose a useful string containing svn information
function svnify {
ref=$(svn info 2> /dev/null) || return
echo -e "\n[SVN branch: $(__svn__dirty)] "
}