sapling/tests/test-pushrebase.t
Mateusz Kwapich bd3030045b hgsql: move repo._afterlock callbacks execution after the sqllock release
Summary:
We are overriding the _afterlock to mind one more lock before executing
callbacks. We need that so our post commit hooks are executed out of the lock.

Test Plan: run tests

Reviewers: #sourcecontrol, ttung, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D2809038

Signature: t1:2809038:1452124328:3b1d2da7711cdf1c97fe06d5dcf07be253582fcd
2016-01-06 16:37:46 -08:00

57 lines
1.4 KiB
Perl

$ $PYTHON -c 'import pushrebase' || exit 80
$ . "$TESTDIR/library.sh"
$ cat >> $HGRCPATH <<EOF
> [extensions]
> pushrebase=
> [experimental]
> bundle2lazylocking=True
> EOF
Test verify sql lock is not held during prelockrebase and txnclose hooks
$ cat >> $TESTTMP/locktester.py <<EOF
> import os
> from mercurial import extensions, bundle2, util
> def checklock(repo, *args, **kwargs):
> if len(repo.heldlocks) > 0:
> raise util.Abort("lock was TAKEN")
> raise util.Abort("lock was FREE")
> EOF
$ initserver master master
$ cat >> master/.hg/hgrc <<EOF
> [hooks]
> prepushrebase=python:$TESTTMP/locktester.py:checklock
> txnclose=python:$TESTTMP/locktester.py:checklock
> EOF
$ cd master
$ touch a && hg ci -Aqm a
error: txnclose hook failed: lock was FREE
error: txnclose hook failed: lock was FREE
error: txnclose hook failed: lock was FREE
error: txnclose hook failed: lock was FREE
error: txnclose hook failed: lock was FREE
$ hg book master
error: txnclose hook failed: lock was FREE
$ cd ..
$ initclient client
$ cd client
$ hg pull -q ssh://user@dummy/master
$ hg up -q master
$ touch b && hg ci -Aqm b
$ hg push ssh://user@dummy/master --to master
pushing to ssh://user@dummy/master
searching for changes
remote: error: prepushrebase hook failed: lock was FREE
remote: lock was FREE
abort: push failed on remote
[255]
$ cd ../master
$ hg log -T '{rev}\n'
0