zsh_completion: add completion of branch names
authorJohannes Schlatow <johannes@schlatow.name>
Thu, 17 Jan 2013 00:54:49 +0100
changeset 18420 c2792fe15025
parent 18419 45bb5df43b81
child 18421 e8982483f9dc
zsh_completion: add completion of branch names
contrib/zsh_completion
--- a/contrib/zsh_completion	Thu Jan 17 01:55:50 2013 +0100
+++ b/contrib/zsh_completion	Thu Jan 17 00:54:49 2013 +0100
@@ -213,6 +213,13 @@
   heads=(${heads:#$myrev})
 
   (( $#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 )) && _describe -t branches 'branches' branches
 }
 
 _hg_files() {