From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1542 invoked by alias); 29 Aug 2018 00:18:15 -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: List-Unsubscribe: X-Seq: 43347 Received: (qmail 26858 invoked by uid 1010); 29 Aug 2018 00:18:15 -0000 X-Qmail-Scanner-Diagnostics: from nl.dwimlabs.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(81.4.124.96):SA:0(-1.9/5.0):. Processed in 2.384436 secs); 29 Aug 2018 00:18:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: av6@dwimlabs.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dwimlabs.net; s=20171204; t=1535501887; bh=WPoc3xYU7o4kXvbI7K3KUgQVSoX1HvAGLqEfwmn8w3I=; h=From:To:Cc:Subject:Date:From; b=DtRzfNe0ZeKBlwu/IxmF14aoGSMctJhA7smxo2YdIGshZ5dVAn5hAuMnrO3665wTK MMmSgkMBIat5F3nOqoyX0qSTbsY5KaBUDOavvd9+8RjaviE7S/HAsnXMcT9k/JEsc7 EUnS43uuisBZm1UUegAL5wPvFw8ti+Ksz/b20GiA= From: Anton Shestakov To: zsh-workers@zsh.org Cc: Anton Shestakov Subject: [PATCH 1/2] _hg: use revsets for suggestions for hg merge Date: Wed, 29 Aug 2018 08:17:30 +0800 Message-Id: <20180829001731.1856-1-av6@dwimlabs.net> X-Mailer: git-send-email 2.11.0 Using Mercurial's functional language for selecting a set of revisions allows getting all heads minus current revision using just one call to hg. The difference in responsiveness is definitely noticeable, especially on larger repos. Sorting by revision (descending) is done just to have the same ordering as hg heads, until someone figures out a better one. --- Completion/Unix/Command/_hg | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index 4b88ce4ea..d92112e68 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -192,13 +192,9 @@ _hg_tags() { # likely merge candidates _hg_mergerevs() { typeset -a heads - local myrev - - heads=(${(f)"$(_hg_cmd heads --template '{rev}\\n')"}) - # exclude own revision - myrev=$(_hg_cmd log -r . --template '{rev}\\n') - heads=(${heads:#$myrev}) + local revset='sort(head() and not ., -rev)' + heads=(${(f)"$(_hg_cmd log -r '$revset' --template '{rev}\\n')"}) (( $#heads )) && _describe -t heads 'heads' heads } -- 2.11.0