mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
216c7fc2c5
Summary: If two repositories have conflicting obsmarker information that has not been shared through commit cloud, then they can enter a state where they fight over the visibility of the commit, and the cloud workspace oscillates between two views. This adds a test to demonstrate this occurring. Reviewed By: quark-zju Differential Revision: D9845983 fbshipit-source-id: d5c74bed25da5721f273e53df10bf7b88efe2850
253 lines
6.6 KiB
Perl
253 lines
6.6 KiB
Perl
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> fbamend =
|
|
> infinitepush =
|
|
> infinitepushbackup =
|
|
> commitcloud =
|
|
> rebase =
|
|
> remotenames =
|
|
> share =
|
|
> [ui]
|
|
> ssh = python "$TESTDIR/dummyssh"
|
|
> [infinitepush]
|
|
> branchpattern = re:scratch/.*
|
|
> [commitcloud]
|
|
> hostname = testhost
|
|
> [experimental]
|
|
> evolution = createmarkers, allowunstable
|
|
> EOF
|
|
|
|
$ hg init server
|
|
$ cd server
|
|
$ cat >> .hg/hgrc << EOF
|
|
> [infinitepush]
|
|
> server = yes
|
|
> indextype = disk
|
|
> storetype = disk
|
|
> reponame = testrepo
|
|
> EOF
|
|
$ touch base
|
|
$ hg commit -Aqm base
|
|
$ hg phase -p .
|
|
$ cd ..
|
|
|
|
Make shared part of config
|
|
$ cat >> shared.rc << EOF
|
|
> [commitcloud]
|
|
> servicetype = local
|
|
> servicelocation = $TESTTMP
|
|
> user_token_path = $TESTTMP
|
|
> auth_help = visit https://localhost/oauth to generate a registration token
|
|
> education_page = https://someurl.com/wiki/CommitCloud
|
|
> owner_team = The Test Team @ FB
|
|
> EOF
|
|
|
|
Utility script to dump commit cloud metadata
|
|
$ cat > dumpcommitcloudmetadata.py <<EOF
|
|
> import json
|
|
> ccmd = json.load(open("commitcloudservicedb"))
|
|
> print("version: %s" % ccmd["version"])
|
|
> print("heads:")
|
|
> for head in sorted(ccmd["heads"]):
|
|
> print(" %s" % head)
|
|
> EOF
|
|
|
|
Make a clone of the server
|
|
$ hg clone ssh://user@dummy/server client1 -q
|
|
$ cd client1
|
|
$ cat ../shared.rc >> .hg/hgrc
|
|
$ hg cloud auth -t xxxxxx
|
|
setting authentication token
|
|
authentication successful
|
|
|
|
Connect the first client
|
|
$ hg cloud join
|
|
#commitcloud this repository is now connected to the 'user/test/default' workspace for the 'server' repo
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
#commitcloud commits synchronized
|
|
|
|
Make some commits
|
|
$ hg debugdrawdag <<EOS
|
|
> C E G
|
|
> | | |
|
|
> B D F
|
|
> \|/
|
|
> A
|
|
> |
|
|
> 0
|
|
> EOS
|
|
$ hg cloud sync
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 7 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
remote: 449486ddff7a D
|
|
remote: 64b4d9634423 F
|
|
remote: 65299708466c C
|
|
remote: 27ad02806080 E
|
|
remote: 878302dcadc7 G
|
|
#commitcloud commits synchronized
|
|
$ tglogp
|
|
o 7: 878302dcadc7 draft 'G'
|
|
|
|
|
| o 6: 27ad02806080 draft 'E'
|
|
| |
|
|
| | o 5: 65299708466c draft 'C'
|
|
| | |
|
|
o | | 4: 64b4d9634423 draft 'F'
|
|
| | |
|
|
| o | 3: 449486ddff7a draft 'D'
|
|
|/ /
|
|
| o 2: 14bec91a4bc5 draft 'B'
|
|
|/
|
|
o 1: 04b96a2be922 draft 'A'
|
|
|
|
|
@ 0: df4f53cec30a public 'base'
|
|
|
|
|
|
Create a new client that isn't connected yet
|
|
$ cd ..
|
|
$ hg clone ssh://user@dummy/server client2 -q
|
|
$ cat shared.rc >> client2/.hg/hgrc
|
|
|
|
Share commits A B C D and E into the repo manually with a bundle
|
|
$ hg bundle -q -R client1 --base 0 -r 'A+B+C+D+E' ABCDE.hg
|
|
$ hg unbundle -R client2 ABCDE.hg
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 5 changesets with 5 changes to 5 files (+1 heads)
|
|
new changesets 04b96a2be922:27ad02806080
|
|
(run 'hg heads' to see heads, 'hg merge' to merge)
|
|
$ cd client2
|
|
$ tglogp
|
|
o 5: 27ad02806080 draft 'E'
|
|
|
|
|
| o 4: 65299708466c draft 'C'
|
|
| |
|
|
o | 3: 449486ddff7a draft 'D'
|
|
| |
|
|
| o 2: 14bec91a4bc5 draft 'B'
|
|
|/
|
|
o 1: 04b96a2be922 draft 'A'
|
|
|
|
|
@ 0: df4f53cec30a public 'base'
|
|
|
|
|
|
Hide commits C D and E without the commitcloud extension enabled
|
|
$ hg hide 3 4 5 --config extensions.commitcloud=!
|
|
hiding commit 449486ddff7a "D"
|
|
hiding commit 65299708466c "C"
|
|
hiding commit 27ad02806080 "E"
|
|
3 changesets hidden
|
|
|
|
Connect to commit cloud
|
|
$ hg cloud join
|
|
#commitcloud this repository is now connected to the 'user/test/default' workspace for the 'server' repo
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
pulling from ssh://user@dummy/server
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 2 changesets with 2 changes to 3 files (+1 heads)
|
|
new changesets 64b4d9634423:878302dcadc7
|
|
(run 'hg heads' to see heads, 'hg merge' to merge)
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 2 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
#commitcloud commits synchronized
|
|
|
|
BUG: Syncing in each client oscillates the set of commits
|
|
$ cd ..
|
|
$ hg -R client1 cloud sync
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 5 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
remote: 449486ddff7a D
|
|
remote: 65299708466c C
|
|
remote: 27ad02806080 E
|
|
#commitcloud commits synchronized
|
|
$ python dumpcommitcloudmetadata.py
|
|
version: 4
|
|
heads:
|
|
27ad028060800678c2de95fea2e826bbd4bf2c21
|
|
65299708466caa8f13c05d82e76d611c183defee
|
|
878302dcadc7a800f326d8e06a5e9beec77e5a1c
|
|
$ hg -R client2 cloud sync
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 2 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
#commitcloud commits synchronized
|
|
$ python dumpcommitcloudmetadata.py
|
|
version: 5
|
|
heads:
|
|
14bec91a4bc5aae750c73e42be20b4b296e2d121
|
|
878302dcadc7a800f326d8e06a5e9beec77e5a1c
|
|
$ hg -R client1 cloud sync
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 5 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
remote: 449486ddff7a D
|
|
remote: 65299708466c C
|
|
remote: 27ad02806080 E
|
|
#commitcloud commits synchronized
|
|
$ python dumpcommitcloudmetadata.py
|
|
version: 6
|
|
heads:
|
|
27ad028060800678c2de95fea2e826bbd4bf2c21
|
|
65299708466caa8f13c05d82e76d611c183defee
|
|
878302dcadc7a800f326d8e06a5e9beec77e5a1c
|
|
$ hg -R client2 cloud sync
|
|
#commitcloud synchronizing 'server' with 'user/test/default'
|
|
backing up stack rooted at 04b96a2be922
|
|
remote: pushing 2 commits:
|
|
remote: 04b96a2be922 A
|
|
remote: 14bec91a4bc5 B
|
|
#commitcloud commits synchronized
|
|
$ python dumpcommitcloudmetadata.py
|
|
version: 7
|
|
heads:
|
|
14bec91a4bc5aae750c73e42be20b4b296e2d121
|
|
878302dcadc7a800f326d8e06a5e9beec77e5a1c
|
|
|
|
BUG: Smartlogs do not match
|
|
$ cd client1
|
|
$ tglogp
|
|
o 7: 878302dcadc7 draft 'G'
|
|
|
|
|
| o 6: 27ad02806080 draft 'E'
|
|
| |
|
|
| | o 5: 65299708466c draft 'C'
|
|
| | |
|
|
o | | 4: 64b4d9634423 draft 'F'
|
|
| | |
|
|
| o | 3: 449486ddff7a draft 'D'
|
|
|/ /
|
|
| o 2: 14bec91a4bc5 draft 'B'
|
|
|/
|
|
o 1: 04b96a2be922 draft 'A'
|
|
|
|
|
@ 0: df4f53cec30a public 'base'
|
|
|
|
$ cd ../client2
|
|
$ tglogp
|
|
o 7: 878302dcadc7 draft 'G'
|
|
|
|
|
o 6: 64b4d9634423 draft 'F'
|
|
|
|
|
| o 2: 14bec91a4bc5 draft 'B'
|
|
|/
|
|
o 1: 04b96a2be922 draft 'A'
|
|
|
|
|
@ 0: df4f53cec30a public 'base'
|
|
|