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
55 lines
1.7 KiB
Perl
55 lines
1.7 KiB
Perl
$ . "$TESTDIR/hgsql/library.sh"
|
|
|
|
Populate the db with an initial commit
|
|
|
|
$ initserver master masterrepo
|
|
$ cd master
|
|
$ echo a > a
|
|
$ hg commit -Aqm 'add a'
|
|
$ echo b > b
|
|
$ hg commit -Aqm 'add b'
|
|
$ hg up -q 0
|
|
$ echo c > c
|
|
$ hg commit -Aqm 'add c'
|
|
|
|
Run with a correct revlog
|
|
|
|
$ hg sqlverify
|
|
Verification passed
|
|
|
|
Run with incorrect local revlogs
|
|
|
|
$ hg strip -r 1 --config hgsql.bypass=True
|
|
saved backup bundle to $TESTTMP/master/.hg/strip-backup/7c3bad9141dc-81844e36-backup.hg (glob)
|
|
$ hg unbundle --config hgsql.bypass=True $TESTTMP/master/.hg/strip-backup/7c3bad9141dc-81844e36-backup.hg
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
|
new changesets 7c3bad9141dc
|
|
(run 'hg heads' to see heads, 'hg merge' to merge)
|
|
|
|
$ hg log -r tip --forcesync -T '{desc}\n'
|
|
add b
|
|
$ hg sqlverify >$TESTTMP/sqlverify.out 2>&1 || true
|
|
$ grep Corruption $TESTTMP/sqlverify.out || cat $TESTTMP/sqlverify.out
|
|
edenscm.hgext.hgsql.CorruptionException: * with linkrev *, disk does not match mysql (glob)
|
|
|
|
$ hg strip -q -r 1: --config hgsql.bypass=True --no-backup
|
|
$ hg log -r tip --forcesync -T '\n'
|
|
|
|
|
|
Run with correct changelog but incorrect revlogs
|
|
$ hg sqlverify
|
|
Verification passed
|
|
$ mkdir .hg/store/backups
|
|
$ cp .hg/store/00changelog* .hg/store/backups/
|
|
$ echo >> a
|
|
$ hg commit -qm "modify a" --config hgsql.bypass=True
|
|
$ cp .hg/store/backups/* .hg/store/
|
|
$ hg sqlverify
|
|
corruption: 'data/a.i:eb2346e7cf59326667069bf8647698840687803d' with linkrev 3 exists on local disk, but not in sql
|
|
corruption: '00manifest.i:05e2c764eb21dd7c597aab767cec621af1292344' with linkrev 3 exists on local disk, but not in sql
|
|
abort: Verification failed
|
|
[255]
|