Unable to use "hg push" in pretxnchangegroup hook
Simon King
simon at simonking.org.uk
Wed Dec 5 22:15:41 UTC 2012
Hi all,
I recently upgraded the version of mercurial on my server from 2.0.2
to 2.4, and discovered that one of my hooks no longer worked after the
upgrade.
I was using "hg push <otherrepo>" in a pretxnchangegroup hook to
transfer changes pushed to one repo into a second repo. The idea was
that if the changes weren't accepted into the second repo (because of
various auditing hooks that are installed in the second repo), then
the hook will fail and the push to the first repo will be rolled back.
This worked fine with hg 2.0.2.
In 2.4, the "hg push" run by the hook fails because it tries to lock
the local repository, but it can't because the repository is already
locked by the original push operation.
I assume (but haven't bisected to verify) that this is similar to bug
3684 - "hg push" now needs to lock the local repository in order to
update the local phase information.
I've worked around the problem with an in-process hook, but should I
raise a bug for the original problem, or will it be marked as a
duplicate of 3684?
I did wonder whether a mechanism to allow a child hg process launched
by a hook to inherit the locks of their parent process would be
useful, but it's probably a bad idea.
Thanks,
Simon
More information about the Mercurial
mailing list