summaryrefslogtreecommitdiff
path: root/.zsh/functions/VCS_INFO_get_data_hg
blob: d92d83aa7277916a6e1ff89eece518215260af4d (plain)
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
## 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 hghash hglrev hgmisc r_branch r_info revformat
local hgunstaged

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

hghash=''
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.

    HGRCPATH="/dev/null" ${vcs_comm[cmd]} branches \
    | while read -r r_branch r_info ; do
        if [[ ${r_branch} == ${hgbranch_name} ]] ; then
            match=()
            : ${r_info/(#b)([^:]##):(*)}
            hglrev=${match[1]}
            hghash=${match[2]}
            break
        fi
    done

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

    if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" ; then
        [[ -n $(${vcs_comm[cmd]} status -q 2> /dev/null) ]] && hgunstaged=1
    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}" '' "${hgunstaged}" "${hglrev}" "${hgmisc}"
return 0
href='/feed2imap-go.git/commit/pkg/version/version.go?h=v0.4.1&id=532aee5faa3b075223a1bae0fa150cb1dd8bdbc6&follow=1'>Prepare release 0.3.0v0.3.0René 'Necoro' Neumann3-5/+6 2020-05-10Fixed linebreaks for Enclosures in text templateRené 'Necoro' Neumann1-5/+5 2020-05-10Upgrade html2textRené 'Necoro' Neumann2-5/+3 2020-05-10Switch to our own html2text fork for the time beingRené 'Necoro' Neumann3-5/+5 2020-05-10Text part in emailsRené 'Necoro' Neumann7-33/+115 2020-05-10Allow options on group level.René 'Necoro' Neumann3-5/+11 2020-05-10Renamed feed template to html templateRené 'Necoro' Neumann2-2/+2 2020-05-10Release v0.2.0v0.2.0René 'Necoro' Neumann2-2/+6 2020-05-10Fix building cacheRené 'Necoro' Neumann1-1/+3 2020-05-10Update READMERené 'Necoro' Neumann1-5/+44 2020-05-10Ignore 'dist' folder and build productsRené 'Necoro' Neumann1-0/+2 2020-05-08Print item hashes in debug modeRené 'Necoro' Neumann1-1/+7 2020-05-07Improve html renderingRené 'Necoro' Neumann2-53/+32 2020-05-07Do not assume items to be new when their published date is newer than the las...René 'Necoro' Neumann2-7/+1 2020-05-07Updating some depsRené 'Necoro' Neumann2-2/+7 2020-05-07Better detection if a text starts with html or notRené 'Necoro' Neumann2-4/+13 2020-05-07go fmtRené 'Necoro' Neumann1-3/+2 2020-05-07Add header X-Feed2Imap-GUIDRené 'Necoro' Neumann3-1/+7 2020-05-07update changelogRené 'Necoro' Neumann1-0/+1 2020-05-07FixRené 'Necoro' Neumann1-1/+1 2020-05-07Unified publishedDate and updatedDate into one (just as the old feed2imap...)René 'Necoro' Neumann5-21/+32 2020-05-06Print version during startupRené 'Necoro' Neumann1-1/+1 2020-05-06Improve templateRené 'Necoro' Neumann3-20/+28 2020-05-05Fix pipelineRené 'Necoro' Neumann1-2/+5 2020-05-05Make changelog a part of the release pipeline (untested)René 'Necoro' Neumann2-0/+12