sapling/tests/test-infinitepush-sql.t
Stanislau Hlebik 3b8d29f56b infinitepush: implement saveoptionaljsonmetadata for sqlindexapi
Summary:
Also need to use `with index` to make sure that transaction closes.

Depends on D5255664

Test Plan: arc unit

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, mitrandir, mjpieters, medson, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D5255670

Tasks: 19103180

Signature: t1:5255670:1497557000:906a39810931d92f30c6d6b8e5bfc28e0c888594
2017-06-19 01:27:31 -07:00

80 lines
2.8 KiB
Perl

#if no-osx
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -d "0 0" -m "$1"
> }
$ . "$TESTDIR/library-infinitepush.sh"
$ setupcommon
With no configuration it should abort
$ hg init server
$ cd server
$ setupsqlserverhgrc babar
$ hg st
abort: please set infinitepush.sqlhost
[255]
$ setupdb
$ cd ..
$ hg clone -q ssh://user@dummy/server client1
$ hg clone -q ssh://user@dummy/server client2
$ cd client1
$ setupsqlclienthgrc
$ cd ../client2
$ setupsqlclienthgrc
$ cd ../client1
$ mkcommit scratchcommit
$ hg push -r . --to scratch/book --create
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 1 commit:
remote: 2d9cfa751213 scratchcommit
Make pull and check that scratch commit is not pulled
$ cd ../client2
$ hg pull
pulling from ssh://user@dummy/server
no changes found
$ hg log -r scratch/book
abort: unknown revision 'scratch/book'!
[255]
Pull scratch commit from the second client
$ hg pull -B scratch/book
pulling from ssh://user@dummy/server
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 up scratch/book
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark scratch/book)
$ hg log -G
@ changeset: 0:2d9cfa751213
bookmark: scratch/book
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: scratchcommit
$ cd ../server
$ hg book scratch/%erversidebook
$ hg book serversidebook
$ cd ../client1
$ hg book --list-remote 'scratch/*'
scratch/%erversidebook 0000000000000000000000000000000000000000
scratch/book 2d9cfa7512136a84a6edb6a7c288145229c2ef7f
$ hg book --list-remote 'scratch/%*'
scratch/%erversidebook 0000000000000000000000000000000000000000
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER -p"$DBPASS" -e 'select * from nodesmetadata'
node message p1 p2 author committer author_date committer_date reponame optional_json_metadata
2d9cfa7512136a84a6edb6a7c288145229c2ef7f scratchcommit 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 test test 0 0 babar NULL
$ cd ../server
$ hg debugfillinfinitepushmetadata --node 2d9cfa7512136a84a6edb6a7c288145229c2ef7f
$ mysql -h $DBHOST -P $DBPORT -D $DBNAME -u $DBUSER -p"$DBPASS" -e 'select * from nodesmetadata'
node message p1 p2 author committer author_date committer_date reponame optional_json_metadata
2d9cfa7512136a84a6edb6a7c288145229c2ef7f scratchcommit 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 test test 0 0 babar {"changed_files": {"scratchcommit": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}}}
#endif