1

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:

  1. user pushes changegroup to repo1;
  2. script validate is triggered by pretxnchangegroup hook in repo1, which pushes changegroup to temporary repo2 and run test against it;
  3. 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.

Community
  • 1
  • 1
  • I don't remember exactly how/why I did, but it could be I faced the same problem. Did you try, instead of pushing to repo2, to cd into repo2, and then pull from repo1 ? – Gnurfos Nov 25 '13 at 15:34
  • I found this post from mercurial mailing list: [link](http://mercurial.808500.n3.nabble.com/pretxnchangegroup-hook-fails-because-it-can-t-acquire-lock-td4005013.html). So it seems there is no easy way around this locking issue. As for pulling from repo1 at repo2, it still won't work because those pending changesets are not visible to repo2, until the push opeeraton to repo1 (from user repo) completes. – Perpetual Learner Nov 27 '13 at 04:01

0 Answers0