README.md 1.66 KB
Newer Older
Christian Ferbar's avatar
Christian Ferbar committed
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# `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.

## 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         |

## Caveats

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

To use it, add `svn` to your plugins array:
```sh
plugins=(... svn)
```

### Agnoster theme git-like prompt

Enable the svn plugin and add the followind lines to your ```~/.zshrc```

```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
            prompt_segment yellow black
            echo -n "$rev@$branch"
            echo -n "±"
        else
            prompt_segment green black
            echo -n "$rev@$branch"
        fi
    fi
}
```

override the agnoster build_prompt() function:

```shell
build_prompt() {
    RETVAL=$?
    prompt_status
    prompt_context
    prompt_dir
    prompt_git
    prompt_svn
    prompt_end
}
```