summaryrefslogtreecommitdiff
path: root/Functions/VCS_Info/Backends
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:32:59 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-05-05 23:58:59 +0200
commitdb38e167634b6c2217eec3a5aafc37c46d9e5a8d (patch)
treedaa342d423febbd3a5a7ef97053037677fab004a /Functions/VCS_Info/Backends
parent01eea47617a6e06debdb4330f92ae69f92089fd2 (diff)
parent3c3c8d3d13fd4cf6c03f81ca8dc18a1efd561728 (diff)
downloadzsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.tar.gz
zsh-db38e167634b6c2217eec3a5aafc37c46d9e5a8d.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Functions/VCS_Info/Backends')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git18
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_hg17
2 files changed, 25 insertions, 10 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index ee50be6ca..c348da2a7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -195,14 +195,6 @@ fi
VCS_INFO_adjust
VCS_INFO_git_getaction ${gitdir}
-
-VCS_INFO_get_get_rebase()
-{
- if [[ -f "$1" ]]; then
- echo "$(< "$1")"
- fi
-}
-
local patchdir=${gitdir}/patches/${gitbranch}
if [[ -d $patchdir ]] && [[ -f $patchdir/applied ]] \
&& [[ -f $patchdir/unapplied ]]
@@ -213,6 +205,7 @@ then
elif [[ -d "${gitdir}/rebase-merge" ]]; then
patchdir="${gitdir}/rebase-merge"
local p
+ [[ -f "${patchdir}/done" ]] &&
for p in ${(f)"$(< "${patchdir}/done")"}; do
# remove action
git_patches_applied+=("${${(s: :)p}[2,-1]}")
@@ -223,11 +216,16 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then
# Fake patch names for all but current patch
patchdir="${gitdir}/rebase-apply"
local cur=$(< "${patchdir}/next")
- local p
+ local p subject
for p in $(seq $(($cur - 1))); do
git_patches_applied+=("$(printf "%04d" $p) ?")
done
- git_patches_applied+=("$(< "${patchdir}/original-commit") ${${(f)$(< "${patchdir}/msg-clean")}[1]}")
+ subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
+ if [[ -f "${patchdir}/original-commit" ]]; then
+ git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
+ else
+ git_patches_applied+=("? $subject")
+ fi
git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
VCS_INFO_git_handle_patches
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index cedaf5676..1274ca337 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -6,6 +6,7 @@
setopt localoptions extendedglob NO_shwordsplit
local hgbase bmfile branchfile rebasefile dirstatefile mqseriesfile \
+ curbmfile curbm \
mqstatusfile mqguardsfile patchdir mergedir \
r_csetid r_lrev r_branch i_bmhash i_bmname \
revformat branchformat hgactionstring hgchanges \
@@ -24,6 +25,7 @@ r_lrev='' # local revision
patchdir="${hgbase}/.hg/patches"
mergedir="${hgbase}/.hg/merge/"
bmfile="${hgbase}/.hg/bookmarks"
+curbmfile="${hgbase}/.hg/bookmarks.current"
branchfile="${hgbase}/.hg/branch"
rebasefile="${hgbase}/.hg/rebasestate"
dirstatefile="${hgbase}/.hg/dirstate"
@@ -125,8 +127,23 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-bookmarks \
[[ $i_bmhash == $r_csetid* ]] && hgbmarks+=( $i_bmname )
done < ${bmfile}
+ if [[ -r "$curbmfile" ]] ; then
+ curbm=$(<"${curbmfile}")
+ hook_com[hg-active-bookmark]=$curbm
+ else
+ # leave curbm empty and [hg-active-bookmark] undefined.
+ fi
+
if VCS_INFO_hook 'gen-hg-bookmark-string' "${hgbmarks[@]}"; then
+ # If there is an active bookmark, annotate it and put it first.
+ if [[ -n $curbm ]] ; then
+ hgbmarks[(i)$curbm]=()
+ hgbmarks[1,0]="${curbm}*"
+ fi
hgbmstring=${(j:, :)hgbmarks}
+ # Deannotate the array, in case later code expects it to be valid.
+ # (The order is not restored.)
+ [[ -n $curbm ]] && hgbmarks[1]=${${hgbmarks[1]}[1,-2]}
else
hgbmstring=${hook_com[hg-bookmark-string]}
fi