mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
89744897fb
Summary: Previously, when running with an external MySQL setup, it's easy to get the following "mysterious" error when trying to create the "revisions" table: ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes This is a cleanup of many minor areas to make it easier for external users to run the test. * Move database schema to `schema.sql`, which could be used as `mysql` input directly. Remove schema in other places so `schema.sql` is the single source of truth. * Change `repo`, `namespace` fields to `varchar` to save space. * Explicitly set `latin1(_bin)` in schema to avoid potential encoding issues. Also specify `InnoDB` to avoid issues of other engines. * Source `getdb.sh` instead of parsing its output. Simplifies `getdb.sh`. * Provide an example of `getdb.sh` as `getdb.sh.example`. * Add `DROP DATABASE` cleanup. External setup probably don't have `testdb` dropped automatically. * Change `README.md` with the latest instruction about database and test. * Bundle `hg-ssh` so `test-pushpull.t` won't fail if it's missing. Test Plan: `run-tests.py` and it mostly works on a local, non-prod Linux system. Reviewers: #sourcecontrol, rmcelroy Reviewed By: rmcelroy Subscribers: stash, rmcelroy, tja, durham, andrasbelo Differential Revision: https://phabricator.intern.facebook.com/D4313981 Signature: t1:4313981:1490381520:7c0c9af72ac3446c5ee31f8c9b4376c4198a6dc8
182 lines
4.2 KiB
Perl
182 lines
4.2 KiB
Perl
$ . "$TESTDIR/library.sh"
|
|
|
|
# Populate the db with an initial commit
|
|
|
|
$ initclient client
|
|
$ cd client
|
|
$ echo x > x
|
|
$ hg commit -qAm x
|
|
$ cd ..
|
|
|
|
$ initserver master masterrepo
|
|
$ cd master
|
|
$ printf '[phases]\npublish=True\n' >> .hg/hgrc
|
|
$ hg log
|
|
$ hg pull -q ../client
|
|
|
|
$ cd ..
|
|
|
|
# Verify local pushes work
|
|
|
|
$ cd client
|
|
$ echo y > y
|
|
$ hg commit -qAm y
|
|
$ hg phase -p -r 'all()'
|
|
$ hg push ../master --traceback
|
|
pushing to ../master
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
# Verify local pulls work
|
|
$ hg strip -q -r tip
|
|
$ hg pull ../master
|
|
pulling from ../master
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
(run 'hg update' to get a working copy)
|
|
$ hg log --template '{rev} {desc}\n'
|
|
1 y
|
|
0 x
|
|
|
|
# Verify local bookmark pull
|
|
|
|
$ cd ../master
|
|
$ hg book foo -r 0
|
|
$ hg book
|
|
foo 0:b292c1e3311f
|
|
$ cd ../client
|
|
$ hg pull -q ../master
|
|
$ hg book
|
|
foo 0:b292c1e3311f
|
|
|
|
# Verify local bookmark push
|
|
|
|
$ hg book -r tip foo
|
|
moving bookmark 'foo' forward from b292c1e3311f
|
|
$ hg push ../master
|
|
pushing to ../master
|
|
searching for changes
|
|
no changes found
|
|
updating bookmark foo
|
|
[1]
|
|
$ hg book -R ../master
|
|
foo 1:d34c38483be9
|
|
|
|
# Verify explicit bookmark pulls work
|
|
|
|
$ hg up tip
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
$ echo z > z
|
|
$ hg commit -qAm z
|
|
$ hg book foo
|
|
moving bookmark 'foo' forward from d34c38483be9
|
|
$ cd ../master
|
|
$ hg pull -B foo ../client
|
|
pulling from ../client
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
updating bookmark foo
|
|
(run 'hg update' to get a working copy)
|
|
$ hg log -l 1 --template '{rev} {bookmarks}\n'
|
|
2 foo
|
|
|
|
# Push from hgsql to other repo
|
|
|
|
$ hg up -q tip
|
|
$ echo zz > z
|
|
$ hg commit -m z2
|
|
$ hg push ../client
|
|
pushing to ../client
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
# Verify that multiple heads and bookmarks work
|
|
|
|
$ cd ../client
|
|
$ hg up 0
|
|
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
|
|
(leaving bookmark foo)
|
|
$ echo a > a
|
|
$ hg commit -qAm a
|
|
$ hg book bar
|
|
$ hg push -f ../master -B bar
|
|
pushing to ../master
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
|
exporting bookmark bar
|
|
$ hg log -R ../master -T '{rev} {bookmarks}\n' -G
|
|
o 4 bar
|
|
|
|
|
| @ 3
|
|
| |
|
|
| o 2 foo
|
|
| |
|
|
| o 1
|
|
|/
|
|
o 0
|
|
|
|
# Verify syncing with hg-ssh --readonly works
|
|
$ cd ../
|
|
$ cat > ssh.sh << EOF
|
|
> userhost="\$1"
|
|
> SSH_ORIGINAL_COMMAND="\$2"
|
|
> export SSH_ORIGINAL_COMMAND
|
|
> PYTHONPATH="$PYTHONPATH"
|
|
> export PYTHONPATH
|
|
> ${PYTHON:-python} "$TESTDIR/hg-ssh" --read-only "$TESTTMP/master"
|
|
> EOF
|
|
|
|
$ hg -R master --config hgsql.bypass=True strip -r tip
|
|
saved backup bundle to $TESTTMP/master/.hg/strip-backup/2fbb8bb2b903-cf7ff44e-backup.hg (glob)
|
|
$ hg -R client pull --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/master"
|
|
pulling from ssh://user@dummy/$TESTTMP/master
|
|
searching for changes
|
|
no changes found
|
|
|
|
# Verify syncing with pretxnclose hooks works
|
|
$ initserver master2 masterrepo
|
|
$ cd master
|
|
$ touch testpretxnclose
|
|
$ hg commit -Aqm "test pretxnclose"
|
|
$ cd ../master2
|
|
$ cat >> .hg/hgrc <<EOF
|
|
> [hooks]
|
|
> pretxnclose.abort=exit 1
|
|
> EOF
|
|
$ hg log -r tip -T '{rev}\n'
|
|
5
|
|
$ hg strip -q -r tip --config hgsql.bypass=True --config hooks.pretxnclose.abort=
|
|
|
|
# Verify hooks still run, even after sync disabled them temporarily
|
|
$ cd ../client
|
|
$ hg pull -q ../master
|
|
$ hg up -q tip
|
|
$ echo x >> testpretxnclose
|
|
$ hg commit -qm "test pretxnclose 2"
|
|
$ hg push ../master2
|
|
pushing to ../master2
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
transaction abort!
|
|
rollback completed
|
|
abort: pretxnclose.abort hook exited with status 1
|
|
[255]
|