From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16862 invoked by alias); 27 Jan 2015 10:05:49 -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: 34411 Received: (qmail 22927 invoked from network); 27 Jan 2015 10:05:48 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=x-sasl-enc:date:from:to:subject:message-id :mime-version:content-type; s=mesmtp; bh=L02CqUjolVUzLTEqUCZYqSj XUu8=; b=OkvB9Uu3z1kiTAoVDkWnuTPnuBklHlUUvsmnrgRH8j9iWut9lDTb8sj atw36Y3eyznHzfNhe/HwFi147I9AmYt/8p0JsBG/gcK6a7AOG1RKlPIZt//7Fet0 aldoom6ZN7dCbRaX5bNJznwd0yip+ZmKhVEB8OA3RqidwAE9I4mY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:date:from:to:subject :message-id:mime-version:content-type; s=smtpout; bh=L02CqUjolVU zLTEqUCZYqSjXUu8=; b=myRuqVxT9WoC4ZjWX8i8iOPcvS3NPvKok7hepBsAPN9 NELBdJHkk0/7JNDHCilStX6skuzE5XTU3RhhN6ACzreFJEFlrWxjXOIGcLjYg+PI 2vnYhS2pyaYTrtnBBqW60vTdHDYeFcf/cjZ/xPBWQyHU/sZSe1UV0UPWARqA1M9A = X-Sasl-enc: P26wa2nUZ5SNAZzYbL1azd8JpXDa6BAmQ8q/1UuWFZhq 1422353145 Date: Tue, 27 Jan 2015 10:05:43 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] _hg completion: Complete bookmark names for -r Message-ID: <20150127100543.GC1966@tarsus.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Patch to make 'hg checkout ' complete bookmark names in addition to tag names. This patch also modifies the parsing of 'hg tags' in the same context in two ways. It employs --quiet to simplify the hg output being parsed, and stops using _describe, which makes tag names containing backslashes complete correctly. (The problem is that _describe parses colons and backslashes within its arguments, and hg tag names were passed to _describe without escaping. Only backslashes may trigger the problem because hg does not permit tag names to have colons.) Cheers, Daniel (In the above, 'tag names' means hg tags, not zshcompsys tags) --vtzGhvizbBRQ85DL Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-_hg-completion-Complete-bookmark-names-for-r.patch" >>From 3da817ab8b083587b9350b5d8e1fac423c900ffd Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sun, 25 Jan 2015 11:22:18 +0000 Subject: [PATCH] _hg completion: Complete bookmark names for -r While there, simplify `hg tags` parsing. --- Completion/Unix/Command/_hg | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index c18500b..e7c21b9 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -162,15 +162,24 @@ _hg_revrange() { _hg_tags "$@" } -_hg_tags() { - typeset -a tags - local tag rev +_hg_tags_internal() { + local expl + typeset -a hgtags + hgtags=( ${(f)"$(_hg_cmd tags -q 2>/dev/null)"} ) + _wanted tags expl 'tags' compadd -a - hgtags +} - _hg_cmd tags 2> /dev/null | while read tag - do - tags+=(${tag/ # [0-9]#:*}) - done - (( $#tags )) && _describe -t tags 'tags' tags +_hg_bookmarks_internal() { + local expl + typeset -a hgbookmarks + hgbookmarks=( ${(f)"$(_hg_cmd bookmarks -q 2>/dev/null)"} ) + _wanted bookmarks expl 'bookmarks' compadd -a - hgbookmarks +} + +_hg_tags() { + _alternative \ + 'bookmarks:bookmark:_hg_bookmarks_internal' \ + 'tags:tag:_hg_tags_internal' } # likely merge candidates -- 1.9.1 --vtzGhvizbBRQ85DL--