D4426: zsh_completion: use revsets to exclude this rev from suggestions to hg merge

av6 (Anton Shestakov) phabricator at mercurial-scm.org
Mon Sep 3 10:52:04 UTC 2018


av6 updated this revision to Diff 10716.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4426?vs=10682&id=10716

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=(${(S)heads/#*:/})
   (( $#branches )) && _describe -t branches 'branches' branches
 }
 



To: av6, #hg-reviewers
Cc: spectral, mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list