mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
9dc21f8d0b
Summary: D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`. That has nasty problems if both `import mercurial` and `import edenscm.mercurial` are used, because Python would think `mercurial.foo` and `edenscm.mercurial.foo` are different modules so code like `try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)` would fail to handle the `edenscm.mercurial` version. There are also some module-level states (ex. `extensions._extensions`) that would cause trouble if they have multiple versions in a single process. Change imports to use the `edenscm` so ideally the `mercurial` is no longer imported at all. Add checks in extensions.py to catch unexpected extensions importing modules from the old (wrong) locations when running tests. Reviewed By: phillco Differential Revision: D13868981 fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
53 lines
1.3 KiB
Perl
53 lines
1.3 KiB
Perl
$ . "$TESTDIR/hgsql/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 edenscm.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
|
|
(run with --traceback for stack trace)
|
|
$ hg book master
|
|
error: txnclose hook failed: lock was FREE
|
|
(run with --traceback for stack trace)
|
|
$ 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
|