av6 created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers.
REVISION SUMMARY One of the most important aspects of a completion system is its speed, so 2 calls to hg is definitely better than 4. Sorting by rev (descending) is to preserve the same order as in `hg heads` output. While at it, declare branches as an array too. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4426 AFFECTED FILES contrib/zsh_completion CHANGE DETAILS diff --git a/contrib/zsh_completion b/contrib/zsh_completion --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -193,21 +193,13 @@ # likely merge candidates _hg_mergerevs() { - typeset -a heads - local myrev + typeset -a heads branches + local revset='sort(head() and not ., -rev)' - heads=(${(f)"$(_hg_cmd heads --template '{rev}:{branch}\\n')"}) - # exclude own revision - myrev=$(_hg_cmd log -r . --template '{rev}:{branch}\\n') - heads=(${heads:#$myrev}) - + heads=(${(f)"$(_hg_cmd log -r '$revset' --template '{rev}:{branch}\\n')"}) (( $#heads )) && _describe -t heads 'heads' heads - branches=(${(f)"$(_hg_cmd heads --template '{branch}\\n')"}) - # exclude own revision - myrev=$(_hg_cmd log -r . --template '{branch}\\n') - branches=(${branches:#$myrev}) - + branches=(${(f)"$(_hg_cmd log -r '$revset' --template '{branch}\\n')"}) (( $#branches )) && _describe -t branches 'branches' branches } To: av6, #hg-reviewers Cc: mjpieters, mercurial-devel, spectral _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel