From aacd4d5ed67374faf59d09262c260876deb810b9 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Mon, 6 Apr 2009 13:05:48 +0200 Subject: [PATCH] zshrc: handle newer versions of mercurial It seems like the mercurial vcs (hg) does not create a .hg/branch file anymore, if there is only the 'default' branch. That broke hg-detection in vcs_info. This detects hg repositories by the .hg/store directory and defaults to 'default' if there is no .hg/branch file. --- debian/changelog | 7 +++++++ etc/zsh/zshrc | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index dbeee10..6355558 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +grml-etc-core (0.3.67) unstable; urgency=low + + * zshrc: handle newer versions of hg, that don't create .hg/branch + anymore if there's only 'default'. Found by Andreas Korsten. + + -- Frank Terbeck Mon, 06 Apr 2009 13:00:28 +0200 + grml-etc-core (0.3.66) unstable; urgency=low * vimrc: only set screen title if the caller explicitly asks for it. diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 8a836cd..86e5243 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1627,10 +1627,17 @@ VCS_INFO_git_get_data () { # {{{ } # }}} VCS_INFO_hg_get_data () { # {{{ - local hgbranch hgbase + local hgbranch hgbase file hgbase=${vcs_comm[basedir]} - hgbranch=$(< ${hgbase}/.hg/branch) + + file="${hgbase}/.hg/branch" + if [[ -r ${file} ]] ; then + hgbranch=$(< ${file}) + else + hgbranch='default' + fi + VCS_INFO_formats '' "${hgbranch}" "${hgbase}" return 0 } @@ -1691,7 +1698,7 @@ VCS_INFO_detect_by_dir() { #{{{ 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 @@ -1745,7 +1752,7 @@ VCS_INFO_git_detect() { #{{{ # }}} VCS_INFO_hg_detect() { #{{{ VCS_INFO_check_com hg || return 1 - vcs_comm[detect_need_file]=branch + vcs_comm[detect_need_file]=store VCS_INFO_detect_by_dir '.hg' return $? } -- 2.1.4