stdout strangeness

Steve Borho steve at borho.org
Wed Jul 8 00:33:58 CDT 2009


Can anyone explain this behavior?

(test can be any repository)
% hg clone test foo
% cd foo
% echo "[hooks]\nprechangegroup.locked = echo REPOSITORY IS LOCKED &&
exit 1" >> .hg/hgrc
% cd ..
% hg clone test bar
% cd bar
% echo a > a
% hg commit -a -m "test"
% hg push -v ../foo
pushing to ../foo
searching for changes
1 changesets found
running hook prechangegroup.locked: echo REPOSITORY IS LOCKED && exit 1
REPOSITORY IS LOCKED
abort: prechangegroup.locked hook exited with status 1

This is exactly what you would expect.  Now if you run 'hgtk synch',
enter the path, and press the 'push' button, you get this in the
dialog:

pushing to ../foo
searching for changes
1 changesets found
running hook prechangegroup.locked: echo REPOSITORY IS LOCKED && exit 1
abort: prechangegroup.locked hook exited with status 1

Notice the hook output is missing.  If you look in your console
window, you'll find the missing 'REPOSITORY IS LOCKED' message.  The
thing is, the synchronize tool is doing everything I can think of to
get the output of these commands.  I'm subclassing ui and redirecting
write calls to my output window.  I'm redirecting sys.stdout and
sys.stderr to my output window, and I've even tested with redirecting
sys.__stdout__ and sys.__stderr__ to no effect.

I've eliminated a lot of variables.  This happens on Linux as well as
Windows, and it doesn't require the use of any network protocols.
This example does a push to a repo on the same fs.  I'm using push -v
in both instances.

I can't figure out how that hook message is getting to the console.
Anyone have a clue?

--
Steve Borho


More information about the Mercurial mailing list