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
Oh My Zsh
Commits
f573247a
Commit
f573247a
authored
Sep 29, 2016
by
Marc Cornellà
Browse files
Clean up svn README
parent
364019a3
Changes
1
Show whitespace changes
Inline
Side-by-side
plugins/svn/README.md
View file @
f573247a
# `svn` plugin
This plugin adds some utility functions to display additional information regarding your current
svn repsitiory. See http://subversion.apache.org/ for the full svn documentation.
svn repository. See http://subversion.apache.org/ for the full svn documentation.
To use it, add
`svn`
to your plugins array:
```
zsh
plugins
=(
... svn
)
```
## Functions
| Command | Description |
|:----------------------
-
|:----------------------------------------|
|svn_prompt_info
| prompt for some
themes |
|in_svn
| within svn directory
|
|svn_get_repo_name
|
|
|svn_get_branch_name
|
branch name (see
caveats)
|
|svn_get_rev_nr
| revision number |
|svn_dirty
| changes in this subversion repo
|
|:----------------------|:----------------------------------------
----
|
|
`
svn_prompt_info
`
| Shows svn prompt in
themes |
|
`
in_svn
`
| Checks if we're in an svn repository
|
|
`
svn_get_repo_name
`
|
Get repository name
|
|
`
svn_get_branch_name
`
| Get
branch name (see
[
caveats
](
#caveats
)
)
|
|
`
svn_get_rev_nr
`
|
Get
revision number |
|
`
svn_dirty
`
| Checks if there are changes in the svn repo
|
## Caveats
The plugin expects the first directory to be the current branch / tag / trunk. So
,
it returns
The plugin expects the first directory to be the current branch / tag / trunk. So it returns
the first path element if you don't use branches.
## Usage
## Usage
on themes
To use it, add
`svn`
to your plugins array:
```
sh
plugins
=(
... svn
)
```
To use this in the
`agnoster`
theme follow these instructions:
### Agnoster theme git-like prompt
1.
Enable the svn plugin
Enable the svn plugin and a
dd the followin
d
lines to your
`
``~/.
zshrc`
``
2.
A
dd the followin
g
lines to your
`zshrc`
file:
```
shell
prompt_svn
()
{
```shell
prompt_svn() {
local rev branch
if in_svn; then
rev=$(svn_get_rev_nr)
branch=$(svn_get_branch_name)
if
[
`
svn_dirty_choose_pwd 1 0
`
-eq
1
]
;
then
if [[ $(
svn_dirty_choose_pwd 1 0
)
-eq 1
]
]; then
prompt_segment yellow black
echo -n "$rev@$branch"
echo -n "±"
...
...
@@ -45,13 +48,13 @@ prompt_svn() {
echo -n "$rev@$branch"
fi
fi
}
```
}
```
o
verride the agnoster build_prompt() function:
3.
O
verride the agnoster
`
build_prompt()
`
function:
```
sh
ell
build_prompt
()
{
```
z
sh
build_prompt() {
RETVAL=$?
prompt_status
prompt_context
...
...
@@ -59,6 +62,6 @@ build_prompt() {
prompt_git
prompt_svn
prompt_end
}
```
}
```
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