Mercurial changeset hook exists with status -1
I am using Mercurial SCM over a LAN using a normal shared folder instead of HTTP and I'm having a problem getting the auto update hook to run.
I have entered this hook as detailed in the FAQ. This installs the hook, but when I push something to the remote repository, I get an error:
added 1 changesets with 1 changes to 1 files
running hook changegroup: hg update >&2
warning: changegroup hook exited with status -1
There is another stackoverflow question similar to this, but it offers no solutions other than it may be a permissions error somewhere.
Has anyone else had this problem and can anyone else shed any more light on this or gi开发者_如何学运维ve me a heads up on where to start fixing this? Thanks.
Is hg
in your standard search PATH ?
Replace your .hgrc
configuration with a custom script, e.g.
[hooks]
changegroup = /var/tmp/myscript.sh
[ui]
debug = true
(unix) In the /var/tmp/myscript.sh
write something like this:
#!/bin/sh
set -e
echo ---------- >>/tmp/myscript.log
set >>/tmp/myscript.log
echo --- >>/tmp/myscript.log
pwd >>/tmp/myscript.log
hg update >>/tmp/myscript.log 2>&1
(unix) Do not forget to mark as executable: chmod a+x /var/tmp/myscript.sh
(windows) The corresponding batch file myscript.bat
is:
@echo off
echo ------ >>%TEMP%\myscript.log
set >>%TEMP%\myscript.log
echo --- >>%TEMP%\myscript.log
cd >>%TEMP%\myscript.log
hg update >>%TEMP%\myscript.log 2>&1
(windows) Of course, the line in .hgrc
is changegroup = \your\directory\myscript.bat
.
Run your hg push
command to reproduce the problem.
Check the content of the /tmp/myscript.log
file.
精彩评论