From 0f73b35f4e0d8adad216ee6650bfef4622df43b1 Mon Sep 17 00:00:00 2001 From: Marc Finet Date: Thu, 9 Oct 2014 00:24:45 +0200 Subject: 33391: vcs_info git: fix applied patch detection on git am git-am also uses .git/rebase-apply for patch list but the file original-commit does not exist (as no commit exist). This patch handles both git rebase and git am. Also: - get the first line (rather than the first char) when the message contains only one line; - remove unused function (ironically that should have been used here). --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'Functions/VCS_Info') diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index ee50be6ca..48d552f68 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 ]] @@ -223,11 +215,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 -- cgit v1.2.3 From a03227de23f623370ab6a6eaf8d22e8d9b1a3aae Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Thu, 9 Oct 2014 18:09:36 +0200 Subject: 33405: vcs_info: Make sure maxexports is set when VCS_INFO_set is called Reported-by: From: Marco Hinz --- ChangeLog | 5 +++++ Functions/VCS_Info/vcs_info | 1 + 2 files changed, 6 insertions(+) (limited to 'Functions/VCS_Info') diff --git a/ChangeLog b/ChangeLog index 57850eb0e..b27895c8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-10-09 Frank Terbeck + + * 33405: Functions/VCS_Info/vcs_info: Make sure maxexports + is set when VCS_INFO_set is called + 2014-10-09 Marc Finet * 33391: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: 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 -- cgit v1.2.3 From 9ea817acdafc2f9c0377bb30d7931916bcd8bc6a Mon Sep 17 00:00:00 2001 From: Marc Finet Date: Tue, 20 Jan 2015 22:55:07 +0100 Subject: PATCH: 34333: vcs_info quilt: fix unapplied detection in subdir When patches are applied, let quilt use .pc without forcing the patch directory, this will fix the unapplied detection when being in subdir. When no patches are applied, use zstyle quilt-patch-dir then QUILT_PATCHES then "patches" for path to search for patches. Note: prefer setting quilt-patch-dir rather than QUILT_PATCHES for absolute path because when patches are applied, quilt unapplied will not return the correct list (i.e. the whole list rather that the one specified by .pc/.quilt_series). --- ChangeLog | 5 +++++ Functions/VCS_Info/VCS_INFO_quilt | 30 +++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'Functions/VCS_Info') diff --git a/ChangeLog b/ChangeLog index d99da9d44..af9bc04cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-01-22 Marc Finet + + * Functions/VCS_Info/VCS_INFO_quilt: PATCH: 34333: vcs_info quilt: + fix unapplied detection in subdir + 2015-01-22 Jun-ichi Takimoto * 34327: _perl_modules: fix cache identifier used in 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=() -- cgit v1.2.3 From 9d25fd72553caff0008d35670544c0ab909c0224 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 24 Jan 2015 06:41:42 +0000 Subject: vcs_info hg: Support inactive bookmarks (Similar to git detached heads) --- ChangeLog | 6 ++++++ Doc/Zsh/contrib.yo | 7 +++++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 17 +++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'Functions/VCS_Info') diff --git a/ChangeLog b/ChangeLog index 04f46611b..2ca32cec1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-01-25 Daniel Shahaf + + * Doc/Zsh/contrib.yo, + Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: vcs_info hg: + Support inactive bookmarks + 2015-01-23 Jun-ichi Takimoto * 34335: _yum: fix bugs in _yum_all_pkgs diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 00ede52aa..80a799766 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -927,6 +927,10 @@ kindex(get-bookmarks) item(tt(get-bookmarks))( If set to true, the tt(hg) backend will try to get a list of current bookmarks. They will be available via the `tt(%m)' replacement. + +The default is to generate a comma-separated list of all bookmark names +that refer to the currently checked out revision. If a bookmark is active, +its name is suffixed an asterisk and placed first in the list. ) kindex(use-prompt-escapes) item(tt(use-prompt-escapes))( @@ -1290,6 +1294,9 @@ tt(get-revision) and tt(get-bookmarks) styles must be true. This hook gets the names of the Mercurial bookmarks that tt(vcs_info) collected from `hg'. +If a bookmark is active, the key tt(${hook_com[hg-active-bookmark]}) is +set to its name. The key is otherwise unset. + When setting tt(ret) to non-zero, the string in tt(${hook_com[hg-bookmark-string]}) will be used in the tt(%m) escape in tt(formats) and tt(actionformats) and will be available in the global 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 -- cgit v1.2.3 From 57be7b743fbd7afb86edaac3ac86ef34182f86b9 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 9 Mar 2015 20:03:05 +0000 Subject: 34673: vcs_info git: Fix error message when rebase hasn't started --- ChangeLog | 3 +++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 1 + 2 files changed, 4 insertions(+) (limited to 'Functions/VCS_Info') diff --git a/ChangeLog b/ChangeLog index 109027b34..bdb177cfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-03-09 Daniel Shahaf + * 34673: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: + vcs_info git: Fix error message when rebase hasn't started + * 34693: Completion/Unix/Command/_sudo: sudo completion: Don't false positive 'sudo -e' detection diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 48d552f68..c348da2a7 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -205,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]}") -- cgit v1.2.3