sapling/tests/test-fb-hgext-infinitepush-sql.t
Saurabh Singh 551e557862 infinitepush: move library-infinitepush.sh to infinitepush/library.sh
Summary: Makes more sense to have this structure after D6691821.

Test Plan: Ran all the tests.

Reviewers: quark, #mercurial, #sourcecontrol

Reviewed By: quark

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

Signature: 6694171:1515609818:1142419346e3458db7674b1b69036d88e82a1903
2018-01-10 10:44:15 -08:00

81 lines
2.8 KiB
Perl

#if no-osx
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -d "0 0" -m "$1"
> }
$ . "$TESTDIR/infinitepush/library.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
new changesets 2d9cfa751213
(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 $DBPASSOPT -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 $DBPASSOPT -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