diff options
Diffstat (limited to 'Functions/VCS_Info')
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 18 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 17 | ||||
-rw-r--r-- | Functions/VCS_Info/VCS_INFO_quilt | 30 | ||||
-rw-r--r-- | Functions/VCS_Info/vcs_info | 1 |
4 files changed, 43 insertions, 23 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 diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt index db15dda74..34ff1edbf 100644 --- a/Functions/VCS_Info/VCS_INFO_quilt +++ b/Functions/VCS_Info/VCS_INFO_quilt @@ -87,7 +87,7 @@ function VCS_INFO_quilt() { local patches pc tmp qstring root local -i ret local -x context - local -a applied unapplied all applied_string unapplied_string quiltcommand + local -a applied unapplied all applied_string unapplied_string quiltcommand quilt_env local -Ax hook_com context=":vcs_info:${vcs}.quilt-${mode}:${usercontext}:${rrn}" @@ -105,17 +105,6 @@ function VCS_INFO_quilt() { ;; esac - zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}" - if [[ "${patches}" != /* ]]; then - tmp=${patches:-patches} - patches="$(VCS_INFO_quilt-dirfind "${tmp}")" - ret=$? - (( ret )) && return ${ret} - patches=${patches}/${tmp} - else - [[ -d ${patches} ]] || return 1 - fi - pc="$(VCS_INFO_quilt-dirfind .pc .version)" ret=$? if (( ret == 0 )); then @@ -129,12 +118,27 @@ function VCS_INFO_quilt() { else applied=() fi + patches=$(<$pc/.quilt_patches) fi if zstyle -t "${context}" get-unapplied; then # This zstyle call needs to be moved further up if `quilt' needs # to be run in more places than this one. zstyle -s "${context}" quiltcommand quiltcommand || quiltcommand='quilt' - unapplied=( ${(f)"$(QUILT_PATCHES=$patches $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} ) + quilt_env=(env) + if [ -z "$patches" ]; then + zstyle -s "${context}" quilt-patch-dir patches || patches="${QUILT_PATCHES}" + if [[ "${patches}" != /* ]]; then + tmp=${patches:-patches} + patches="$(VCS_INFO_quilt-dirfind "${tmp}")" + ret=$? + (( ret )) && return ${ret} + patches=${patches}/${tmp} + else + [[ -d ${patches} ]] || return 1 + fi + quilt_env+=(QUILT_PATCHES="$patches") + fi + unapplied=( ${(f)"$(${quilt_env[@]} $quiltcommand --quiltrc /dev/null unapplied 2> /dev/null)"} ) unapplied=( ${unapplied:#} ) else unapplied=() diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info index 5a421dfed..46938691d 100644 --- a/Functions/VCS_Info/vcs_info +++ b/Functions/VCS_Info/vcs_info @@ -94,6 +94,7 @@ vcs_info () { for pat in ${dps} ; do if [[ ${PWD} == ${~pat} ]] ; then + VCS_INFO_maxexports [[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --nvcs return 0 fi |