Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is possible to update to a specific tag or branch with the hg update <branch-or-tag> command. However, the built-in completion only shows me tags (not branches). So when i type hg update and hit tab, i get a list of tags, but no branches. Is it possible to add branches to this list?

Or may this even be a bug in Mercurial?

I am using zsh and oh-my-zsh with Mercurial installed via Homebrew.

share|improve this question
up vote 3 down vote accepted

The current code of _hg (Zsh 5.0.2) only completes with tags:

a brief look at the source of _hg (the completion function for mercurial) shows that the completion for hq update (implemented by the function _hg_cmd_update really only returns revisions and tags:

_hg_cmd_update() {
  _arguments -s -w : $_hg_global_opts \
  '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \

Location: I think the easiest thing would be to call locate _hq, but normally I would expect the function to be at /usr/share/zsh/5.0.2/functions. The exact sub-folder may change due to installation options. Safest thing is to download the 5.0.2 tar ball, and look at zsh-5.0.2/Completion/Unix/Command/_hg

share|improve this answer
What a pity :(. Thanks, so far! – Patrick Oscity Jan 24 '13 at 7:31
Where do i find the zsh completion function so i can patch it? I could only find bash completion... – Patrick Oscity Jan 24 '13 at 7:33

The version of the tab completion script for mercurial that ships with zsh is a bit out of date (doesn't support bookmarks or branches). There is a more up to date version in the mercurial source. homebrew doesn't seem to install this script so I found the best thing is to download the mercurial source and add the zsh_completion script to the zsh fpath.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .