Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/2] _hg: use revsets for suggestions for hg merge
- X-seq: zsh-workers 43347
- From: Anton Shestakov <av6@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/2] _hg: use revsets for suggestions for hg merge
- Date: Wed, 29 Aug 2018 08:17:30 +0800
- Cc: Anton Shestakov <av6@xxxxxxxxxxxx>
- 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=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author