Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
f66ab7f9
Commit
f66ab7f9
authored
Jan 08, 2014
by
Brice Dutheil
Browse files
Renamed the methods of this script
parent
8ede6c6a
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/svn-fast-info/svn-fast-info.plugin.zsh
View file @
f66ab7f9
...
@@ -4,12 +4,10 @@
...
@@ -4,12 +4,10 @@
#
#
# Works with svn 1.6, 1.7, 1.8.
# Works with svn 1.6, 1.7, 1.8.
# Use `svn_prompt_info` method to enquire the svn data.
# Use `svn_prompt_info` method to enquire the svn data.
# It's faster because his efficient use of svn (single svn call) done in the `parse_svn` function
# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
# Also changed prompt suffix *after* the svn dirty marker
# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
#
# *** IMPORTANT *** DO NO USE with the simple svn plugin, this plugin acts as a replacement of it.
function
svn_
promp
t_info
()
{
function
svn_
fas
t_info
()
{
local
info
local
info
info
=
$(
svn info 2>&1
)
||
return
1
;
# capture stdout and stderr
info
=
$(
svn info 2>&1
)
||
return
1
;
# capture stdout and stderr
local
repo_need_upgrade
=
$(
svn_repo_need_upgrade
$info
)
local
repo_need_upgrade
=
$(
svn_repo_need_upgrade
$info
)
...
@@ -32,10 +30,10 @@ function svn_prompt_info() {
...
@@ -32,10 +30,10 @@ function svn_prompt_info() {
$ZSH_PROMPT_BASE_COLOR
\
$ZSH_PROMPT_BASE_COLOR
\
\
\
$ZSH_THEME_BRANCH_NAME_COLOR
\
$ZSH_THEME_BRANCH_NAME_COLOR
\
$(
svn_
ge
t_branch_name
$info
)
\
$(
svn_
curren
t_branch_name
$info
)
\
$ZSH_PROMPT_BASE_COLOR
\
$ZSH_PROMPT_BASE_COLOR
\
\
\
$(
svn_
ge
t_revision
$info
)
\
$(
svn_
curren
t_revision
$info
)
\
$ZSH_PROMPT_BASE_COLOR
\
$ZSH_PROMPT_BASE_COLOR
\
\
\
$ZSH_THEME_SVN_PROMPT_SUFFIX
\
$ZSH_THEME_SVN_PROMPT_SUFFIX
\
...
@@ -43,21 +41,20 @@ function svn_prompt_info() {
...
@@ -43,21 +41,20 @@ function svn_prompt_info() {
fi
fi
}
}
function
svn_repo_need_upgrade
()
{
function
svn_repo_need_upgrade
()
{
grep
-q
"E155036"
<<<
${
1
:-
$(
svn info 2> /dev/null
)
}
&&
\
grep
-q
"E155036"
<<<
${
1
:-
$(
svn info 2> /dev/null
)
}
&&
\
echo
"E155036: upgrade repo with svn upgrade"
echo
"E155036: upgrade repo with svn upgrade"
}
}
function
svn_
ge
t_branch_name
()
{
function
svn_
curren
t_branch_name
()
{
grep
'^URL:'
<<<
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
| egrep
-o
'(tags|branches)/[^/]+|trunk'
grep
'^URL:'
<<<
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
| egrep
-o
'(tags|branches)/[^/]+|trunk'
}
}
function
svn_
get_
repo_root_name
()
{
function
svn_repo_root_name
()
{
grep
'^Repository\ Root:'
<<<
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
|
sed
's#.*/##'
grep
'^Repository\ Root:'
<<<
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
|
sed
's#.*/##'
}
}
function
svn_
ge
t_revision
()
{
function
svn_
curren
t_revision
()
{
echo
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
|
sed
-n
's/Revision: //p'
echo
"
${
1
:-
$(
svn info 2> /dev/null
)
}
"
|
sed
-n
's/Revision: //p'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment