about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnton Shestakov <av6@dwimlabs.net>2018-08-29 08:17:30 +0800
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-08-29 17:23:04 +0200
commit06f3bc09c0aad4916198823cfe018950475a9cc0 (patch)
tree31b3604232f46e5f6a74296e23cdeb07a5e282ae
parent419625bf879c70869552e614e05d84f47c792bdf (diff)
downloadzsh-06f3bc09c0aad4916198823cfe018950475a9cc0.tar.gz
zsh-06f3bc09c0aad4916198823cfe018950475a9cc0.tar.xz
zsh-06f3bc09c0aad4916198823cfe018950475a9cc0.zip
43347: _hg: use revsets for suggestions for hg merge
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_hg8
2 files changed, 7 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 49c970e4e..252b9266c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-29  Oliver Kiddle  <okiddle@yahoo.co.uk>
+
+	* 43347: Anton Shestakov: Completion/Unix/Command/_hg:
+	use revsets for suggestions for hg merge
+
 2018-08-28  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
 	* 43345: Completion/Unix/Command/_mount,
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
 }