zsh-workers
 help / color / mirror / code / Atom feed
66890151ce0579eee82972cfbb01c691f0208cd8 blob 2318 bytes (raw)

 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 
## vim:ft=zsh
## mercurial support by: Frank Terbeck <ft@bewatermyfriend.org>
## Distributed under the same BSD-ish license as zsh itself.

setopt localoptions NO_shwordsplit
local file hgbranch hgbranch_name hgbase hglhash hgshash hglrev hgmisc \
    r_branch hgchanges revformat

VCS_INFO_hg_get_mq_top_patch () {
    local patchdir=$1

    if [[ -e "${patchdir}/status" ]]; then
        local -a patches
        patches=(${(f)"$(< "${patchdir}/status")"})
        printf "%s" "${patches[-1]/[^:]*:/}"
        return 0
    fi

    return 1
}


hgbase=${vcs_comm[basedir]}
rrn=${hgbase:t}

file="${hgbase}/.hg/branch"
if [[ -r ${file} ]] ; then
    hgbranch_name=$(< ${file})
else
    hgbranch_name="default"
fi

hglhash=''
hglrev=''
if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
    # Calling the 'hg' program is quite a bit too slow for prompts.
    # If there's a way around that, I'd be interested.
    # Disabled by default anyway, so no harm done.

    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" \
            "check-for-changes" ; then

        HGRCPATH="/dev/null" ${vcs_comm[cmd]} id -i -n -b \
        | read -r hglhash hglrev r_branch

        # Are there uncommitted-changes?
        if [[ $hglrev[-1] == + ]] ; then
            hgchanges=1
        fi

        # Remove uncommitted-changes marker, if any
        hglrev=${hglrev/+/}
        hglhash=${hglhash/+/}
    else
        HGRCPATH="/dev/null" ${vcs_comm[cmd]} \
        parents --template="{node} {node|short} {rev} {branches}\n" \
        | read -r hglhash hgshash hglrev r_branch
    fi

    if [[ -n ${hglrev} ]] ; then
        zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" hgrevformat revformat || revformat="%r:%h"
        zformat -f hglrev "${revformat}" "r:${hglrev}" "h:${hglhash}"
        zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat hgbranch || hgbranch="%b:%r"
        zformat -f hgbranch "${hgbranch}" "b:${hgbranch_name}" "r:${hglrev}"
    fi
else
    hgbranch="${hgbranch_name}"
fi

local patchdir=${hgbase}/.hg/patches/

if [[ -d $patchdir ]] ; then
    hgmisc=$(VCS_INFO_hg_get_mq_top_patch "${patchdir}")

    hgmisc=${hgmisc:-"no patch applied"}
else
    hgmisc=''
fi

VCS_INFO_formats '' "${hgbranch}" "${hgbase}" '' "${hgchanges}" "${hglrev}" "${hgmisc}"
return 0
debug log:

solving 6689015 ...
found 6689015 in https://inbox.vuxu.org/zsh-workers/1266277935-18165-2-git-send-email-ft@bewatermyfriend.org/
found 0b66463 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 0b66463fadee39a0988a3652a8fc27014e97d4a5	Functions/VCS_Info/Backends/VCS_INFO_get_data_hg

applying [1/1] https://inbox.vuxu.org/zsh-workers/1266277935-18165-2-git-send-email-ft@bewatermyfriend.org/
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index 0b66463..6689015 100644

Checking patch Functions/VCS_Info/Backends/VCS_INFO_get_data_hg...
Applied patch Functions/VCS_Info/Backends/VCS_INFO_get_data_hg cleanly.

index at:
100644 66890151ce0579eee82972cfbb01c691f0208cd8	Functions/VCS_Info/Backends/VCS_INFO_get_data_hg

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).