Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: (5/5) Make the hg backend work with new versions of mercurial
- X-seq: zsh-workers 26820
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: (5/5) Make the hg backend work with new versions of mercurial
- Date: Mon, 6 Apr 2009 19:45:38 +0200
- In-reply-to: <1239039938-20782-1-git-send-email-ft@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1239039938-20782-1-git-send-email-ft@xxxxxxxxxxxxxxxxxxx>
VCS_INFO_bydir_detect() now accepts every kind of file in
${vcs_comm[detect_need_file]} not just plain files.
The hg backend uses that by detecting via (paraphrased):
[[ -d .hg ]] && [[ -e .hg/store ]]
where .hg/store is a directory.
If .hg/branch is missing, the branch name defaults to 'default'.
---
Functions/VCS_Info/Backends/VCS_INFO_detect_hg | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 10 ++++++++--
Functions/VCS_Info/VCS_INFO_bydir_detect | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
index 41fcc4b..36078b7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_hg
@@ -7,6 +7,6 @@ setopt localoptions NO_shwordsplit
[[ $1 == '--flavours' ]] && return 1
VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
-vcs_comm[detect_need_file]=branch
+vcs_comm[detect_need_file]=store
VCS_INFO_bydir_detect '.hg'
return $?
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index f8e21a9..d83521b 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -3,11 +3,17 @@
## Distributed under the same BSD-ish license as zsh itself.
setopt localoptions NO_shwordsplit
-local hgbranch hgbranch_name hgbase hghash hglrev r_branch r_info
+local file hgbranch hgbranch_name hgbase hghash hglrev r_branch r_info
hgbase=${vcs_comm[basedir]}
rrn=${hgbase:t}
-hgbranch_name=$(< ${hgbase}/.hg/branch)
+
+file="${hgbase}/.hg/branch"
+if [[ -r ${file} ]] ; then
+ hgbranch_name=$(< ${file})
+else
+ hgbranch_name="default"
+fi
hghash=''
hglrev=''
diff --git a/Functions/VCS_Info/VCS_INFO_bydir_detect b/Functions/VCS_Info/VCS_INFO_bydir_detect
index aff59f3..7985b69 100644
--- a/Functions/VCS_Info/VCS_INFO_bydir_detect
+++ b/Functions/VCS_Info/VCS_INFO_bydir_detect
@@ -10,7 +10,7 @@ realbasedir="$(VCS_INFO_realpath ${basedir})"
while [[ ${realbasedir} != '/' ]]; do
if [[ -n ${vcs_comm[detect_need_file]} ]] ; then
[[ -d ${basedir}/${dirname} ]] && \
- [[ -f ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \
+ [[ -e ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \
break
else
[[ -d ${basedir}/${dirname} ]] && break
--
1.6.2.1.136.g8e24
Messages sorted by:
Reverse Date,
Date,
Thread,
Author