sapling/eden/scm/tests/test-hgsql-bundle2.t
Zeyi (Rice) Fan 92f6f35e7a mark all tests requiring Python 2
Summary:
This diff marks **ALL** mercurial tests requiring Python 2 feature.

After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed.

To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example:

```
HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests
```

or

```
HGTEST_FORCE_PY2=1 python run-tests.py
```

----

Basically this diff are created with the following commands:

```
$ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py
$ sed -i '1s/^/#require py2\n/' test-*.t
$ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list)
# manually adding feature requires for these Python tests.
```

(Note: this ignores all push blocking failures!)

ignore-conflict-markers

Reviewed By: singhsrb

Differential Revision: D19655148

fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
2020-01-30 18:49:21 -08:00

136 lines
3.5 KiB
Perl

#require py2
#chg-compatible
$ . "$TESTDIR/hgsql/library.sh"
$ disable treemanifest
# Populate the db with an initial commit
$ initclient client
$ cat >> client/.hg/hgrc <<EOF
> [experimental]
> bundle2-exp=True
> EOF
$ cd client
$ echo x > x
$ hg commit -qAm x
$ hg bookmark mybook
$ cd ..
$ initserver master masterrepo
$ cat >> master/.hg/hgrc <<EOF
> [experimental]
> bundle2-exp=True
> bundle2lazylocking=True
> EOF
$ cd master
$ hg log
$ hg pull -q ../client
$ cd ..
# Verify bookmarks are not synced if hook returns false
$ cp master/.hg/hgrc master/.hg/hgrc_good
$ cat >> master/.hg/hgrc <<EOF
> [hooks]
> pretxnclose.abort=false
> EOF
$ cd client
$ echo x >> x
$ hg commit -qm x2
$ hg push ssh://user@dummy/master
pushing to ssh://user@dummy/master
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: transaction abort!
remote: rollback completed
remote: pretxnclose.abort hook exited with status 1
abort: push failed on remote
[255]
$ mv ../master/.hg/hgrc_good ../master/.hg/hgrc
$ hg -R ../master bookmarks
mybook 0:b292c1e3311f
$ cd ..
Test lazily acquiring the lock during unbundle
$ cat >> $TESTTMP/locktester.py <<EOF
> import os
> from edenscm.mercurial import extensions, bundle2, util
> def checklock(orig, repo, *args, **kwargs):
> if len(repo.heldlocks) > 0:
> raise util.Abort("Lock should not be taken")
> return orig(repo, *args, **kwargs)
> def extsetup(ui):
> extensions.wrapfunction(bundle2, 'processbundle', checklock)
> EOF
$ initserver lazylock lazylock
$ cat >> lazylock/.hg/hgrc <<EOF
> [extensions]
> locktester=$TESTTMP/locktester.py
> EOF
$ initclient lazylockclient
$ cd lazylockclient
$ touch a && hg ci -Aqm a
- Push with lazy locking off (hook fails)
$ hg push ssh://user@dummy/lazylock
pushing to ssh://user@dummy/lazylock
searching for changes
remote: Lock should not be taken
abort: push failed on remote
[255]
- Push with lazy locking on (hook passes)
$ cat >> ../lazylock/.hg/hgrc <<EOF
> [experimental]
> bundle2lazylocking=True
> EOF
$ hg push ssh://user@dummy/lazylock
pushing to ssh://user@dummy/lazylock
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
$ cd ..
$ rm -rf master*
Test constructing a generaldelta repo
$ hg init --config format.generaldelta=1 gdclient
$ configureclient gdclient
$ cd gdclient
- Insert enough commits to cause the changelog to split to a .d
- This exposes a bug in generaldelta handling.
$ for i in {0..10} ; do
> for k in {0..20000} ; do echo $k$i >> ../logmessage ; done
> echo a >> a ; hg commit -Aql ../logmessage
> done
$ cd ..
$ hg init --config format.generaldelta=1 master1
$ hg init --config format.generaldelta=1 master2
$ configureserver master1 gdrepo
$ configureserver master2 gdrepo
$ hg -R gdclient push -q ssh://user@dummy/master1
$ cd master2
$ cat .hg/requires | grep generaldelta
generaldelta
- Verify the synced changelog is not generaldelta (has a base column)
- and the synced manifest is generaldelta (has a delta column).
$ hg debugindex -c | head -n 1
rev offset length base linkrev nodeid p1 p2
$ hg debugindex -m | head -n 1
rev offset length delta linkrev nodeid p1 p2