From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 210 invoked from network); 19 Jun 2009 14:37:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 19 Jun 2009 14:37:19 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 4011 invoked from network); 19 Jun 2009 14:37:13 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Jun 2009 14:37:13 -0000 Received: (qmail 13171 invoked by alias); 19 Jun 2009 14:37:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27050 Received: (qmail 13150 invoked from network); 19 Jun 2009 14:37:04 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Jun 2009 14:37:04 -0000 Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de [80.67.31.41]) by bifrost.dotsrc.org (Postfix) with ESMTP id 28442801E289 for ; Fri, 19 Jun 2009 16:37:01 +0200 (CEST) Received: from [212.117.84.35] (helo=fsst.voodoo.lan) by smtprelay07.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MHfDA-0007YM-Kt for zsh-workers@sunsite.dk; Fri, 19 Jun 2009 16:37:00 +0200 Received: from hawk by fsst.voodoo.lan with local (Exim 4.69) (envelope-from ) id 1MHfCo-0001MA-HD for zsh-workers@sunsite.dk; Fri, 19 Jun 2009 16:36:38 +0200 From: Frank Terbeck To: zsh-workers@sunsite.dk Subject: PATCH: (2/2) Make the hg backend work with new versions of mercurial Date: Fri, 19 Jun 2009 16:36:38 +0200 Message-Id: <1245422198-5180-3-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 1.6.3.1.169.g33fd In-Reply-To: <1245422198-5180-1-git-send-email-ft@bewatermyfriend.org> References: <1245422198-5180-1-git-send-email-ft@bewatermyfriend.org> X-Df-Sender: 430444 X-Virus-Scanned: ClamAV 0.94.2/9487/Fri Jun 19 13:23:03 2009 on bifrost X-Virus-Status: Clean 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.3.1.169.g33fd