From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1514 invoked from network); 6 Apr 2009 17:47:36 -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 news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 6 Apr 2009 17:47:36 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 88679 invoked from network); 6 Apr 2009 17:46:47 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 6 Apr 2009 17:46:47 -0000 Received: (qmail 674 invoked by alias); 6 Apr 2009 17:46:05 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26820 Received: (qmail 611 invoked from network); 6 Apr 2009 17:46:02 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 6 Apr 2009 17:46:02 -0000 Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.18.16]) by bifrost.dotsrc.org (Postfix) with ESMTP id 4D0C282D4B6C for ; Mon, 6 Apr 2009 19:45:59 +0200 (CEST) Received: from [89.245.57.95] (helo=fsst.voodoo.lan) by smtprelay04.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1LqstL-0005is-JX for zsh-workers@sunsite.dk; Mon, 06 Apr 2009 19:45:52 +0200 Received: from hawk by fsst.voodoo.lan with local (Exim 4.69) (envelope-from ) id 1Lqst9-0005Q0-9T for zsh-workers@sunsite.dk; Mon, 06 Apr 2009 19:45:39 +0200 From: Frank Terbeck To: zsh-workers@sunsite.dk Subject: PATCH: (5/5) Make the hg backend work with new versions of mercurial Date: Mon, 6 Apr 2009 19:45:38 +0200 Message-Id: <1239039938-20782-6-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 1.6.2.1.136.g8e24 In-Reply-To: <1239039938-20782-1-git-send-email-ft@bewatermyfriend.org> References: <1239039938-20782-1-git-send-email-ft@bewatermyfriend.org> X-Df-Sender: 430444 X-Virus-Scanned: ClamAV 0.92.1/9207/Mon Apr 6 13:58:21 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.2.1.136.g8e24