From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9460 invoked by alias); 28 Sep 2012 21:53:44 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30702 Received: (qmail 21524 invoked from network); 28 Sep 2012 21:53:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh-workers@zsh.org Subject: [PATCH 1/2] Removed --debug flag from the hg vcs_info backend Date: Fri, 28 Sep 2012 23:44:05 +0200 Message-Id: <1348868646-24756-1-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 1.7.12.1.382.gb0576a6 X-Df-Sender: [pbs]NDMwNDQ0 From: Seth House The --debug hg flag produces inconsistent output between hg versions and should not be relied upon. Removing this flag precludes obtaining the full 40-character global revision id and so documentation and workarounds should be relied upon instead. --- Doc/Zsh/contrib.yo | 7 +++++-- Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 24aafc3..8dbc095 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -768,7 +768,10 @@ item(tt(hgrevformat))( tt(hg) uses both a hash and a revision number to reference a specific changeset in a repository. With this style you can format the revision string (see tt(branchformat)) to include either or both. It's only -useful when tt(get-revision) is true. +useful when tt(get-revision) is true. Note, the full 40-character revision id +is not available (except when using the tt(use-simple) option) because +executing hg more than once per prompt is too slow; you may customize this +behavior using hooks. ) kindex(max-exports) item(tt(max-exports))( @@ -993,7 +996,7 @@ In tt(hgrevformat) these replacements are done: startsitem() sitem(tt(%r))(The current local revision number.) -sitem(tt(%h))(The current 40-character changeset ID hash identifier.) +sitem(tt(%h))(The current global revision identifier.) endsitem() In tt(patch-format) and tt(nopatch-format) these replacements are done: diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index 48e385c..cedaf56 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -37,12 +37,15 @@ VCS_INFO_adjust # Calling the 'hg' program is quite a bit too slow for prompts. # Disabled by default anyway, so no harm done. if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then - # Calling hexdump is (much) faster than hg but doesn't get the local rev if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple \ && ( VCS_INFO_check_com hexdump ) && [[ -r ${dirstatefile} ]] ; then + # Calling hexdump is (much) faster than hg but doesn't get the local rev r_csetid=$(hexdump -n 20 -e '1/1 "%02x"' ${dirstatefile}) else - hgid_args=( --debug id -i -n -b ) + # Settling for a short (but unique!) hash because getting the full + # 40-char hash in addition to all the other info we want isn't + # available in a single hg invocation + hgid_args=( id -i -n -b ) # Looking for changes is a tad bit slower since the dirstate cache must # first be refreshed before being read @@ -119,7 +122,7 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-bookmarks \ && [[ -r "${bmfile}" ]] && [[ -n "$r_csetid" ]] ; then while read -r i_bmhash i_bmname ; do # Compare hash in bookmarks file with changeset id - [[ $r_csetid == $i_bmhash ]] && hgbmarks+=( $i_bmname ) + [[ $i_bmhash == $r_csetid* ]] && hgbmarks+=( $i_bmname ) done < ${bmfile} if VCS_INFO_hook 'gen-hg-bookmark-string' "${hgbmarks[@]}"; then -- 1.7.12.1.382.gb0576a6