I am trying to use mercurial pretxnchangegroup
hook to run validation test on the incoming changegroup
before the push transaction is complete.
(the idea is from this post: Mercurial pre-push hook scanning the working copy )
The simplified flow is:
- user pushes
changegroup
to repo1; - script
validate
is triggered bypretxnchangegroup
hook in repo1, which pushes changegroup to temporary repo2 and run test against it; - if "validate" fails, reject the changegroup. otherwise, complete the push transaction at repo1.
but here is an unexpected problem:
when "validate" tries to push the changegroup from repo1
to repo2
, it finds repo1
is locked during pretxnchangegroup
and push from repo1
is blocked.
the following is the message from hg:
+hg push repo2 --debug
pushing to repo2
sending capabilities command
query 1; heads
sending batch command
searching for changes
all remote heads known locally
no changes found
preparing listkeys for "phases"
sending listkeys command
try to push obsolete markers to remote
checking for updated bookmarks
preparing listkeys for "bookmarks"
sending listkeys command
waiting for lock on repository repo1 held by 'user:22524'
Is the push from repo1 supposed to be blocked by the lock? How can I get around this problem?
Thanks.