Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH 1/2] _hg: use revsets for suggestions for hg merge



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