Search code examples
mercurialmercurial-queuehgrc

hg aborts on outgoing mq hook


I'm trying to run hg pull -u, but it gives the following error:

searching for changes
/bin/sh: !: not found
abort: preoutgoing.mq-no-push hook exited with status 1

my .hgrc includes this hook, which I'm guessing is causing the problem:

preoutgoing.mq-no-push = ! hg qtop > /dev/null 2>&1

hg incoming gives me the list of changes as I would expect and there are no mq patches in either the local or remote repository (hg qapplied and hg qseries return nothing).

The easy fix was to comment out this part of my .hgrc file. Then I could pull, but on merging I discovered that I had multiple heads in my repository, is that what was causing the error? If so, a more accurate error message might be nice. If not, does anybody have a better workaround?


Solution

  • It turns out that my /bin/sh is jsh, which defines ! differently. To get around this I changed the commands in my .hgrc file to explicitly call bash as follows:

    prechangegroup.mq-no-pull = bash -c "! hg qtop > /dev/null 2>&1"
    preoutgoing.mq-no-push = bash -c "! hg qtop > /dev/null 2>&1"