sapling/eden/hg-server/tests/test-infinitepush-publicscratchbookmarks.t
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

140 lines
4.7 KiB
Perl

#chg-compatible
$ configure dummyssh
$ enable infinitepush remotenames
$ setconfig remotenames.hoist=default 'remotenames.autopullhoistpattern=re:.*'
$ setconfig infinitepush.branchpattern="re:scratch/.+"
$ newrepo server
$ echo base > base
$ hg commit -Aqm base
$ echo 1 > file
$ hg commit -Aqm commit1
$ setconfig infinitepush.server=yes infinitepush.indextype=disk infinitepush.storetype=disk
$ cd $TESTTMP
$ hg clone ssh://user@dummy/server client1 -q
$ hg clone ssh://user@dummy/server client2 -q
$ cd client1
Attempt to push a public commit to a scratch bookmark. There is no scratch
data to push, but the bookmark should be accepted.
$ hg push --to scratch/public --create -r . --traceback
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 0 commits:
Pull this bookmark in the other client
$ cd ../client2
$ hg up scratch/public
pulling 'scratch/public' from 'ssh://user@dummy/server'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log -r . -T '{node|short} "{desc}" {remotebookmarks}\n'
e6c779c67aa9 "commit1" default/scratch/public
$ cd ../client1
Attempt to push a public commit to a real remote bookmark. This should also
be accepted.
$ hg push --to real-public --create -r .
pushing rev e6c779c67aa9 to destination ssh://user@dummy/server bookmark real-public
searching for changes
no changes found
exporting bookmark real-public
[1]
Attempt to push a draft commit to a scratch bookmark. This should still work.
$ echo 2 > file
$ hg commit -Aqm commit2
$ hg push --to scratch/draft --create -r .
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 1 commit:
remote: 3f2e32144a89 commit2
Check the server data is correct.
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/public
e6c779c67aa947c951f334f4f312bd2b21d27e55 (no-eol)
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/draft
3f2e32144a89cb84ece9ddd3ec1ac2ddf440d113 (no-eol)
$ hg bookmarks --cwd $TESTTMP/server
real-public e6c779c67aa9
Make another public scratch bookmark on an older commit.
$ hg up -q 'desc(base)'
$ hg push --to scratch/other --create -r .
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 0 commits:
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/other
d20a80d4def38df63a4b330b7fb688f3d4cae1e3 (no-eol)
Make a new draft commit here, and push it to the other scratch bookmark. This
works because the old commit is an ancestor of the new commit.
$ echo a > other
$ hg commit -Aqm other1
$ hg push --to scratch/other -r .
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 1 commit:
remote: 8bebbb8c3ae7 other1
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/other
8bebbb8c3ae7d0404be1a13386747db4bc43806e (no-eol)
Push the draft commit onto the original public scratch bookmark. It should
fail because the bookmark is not an ancestor of this commit.
$ hg push --to scratch/public -r .
pushing to ssh://user@dummy/server
searching for changes
remote: non-forward push
remote: (use --non-forward-move to override)
abort: push failed on remote
[255]
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/public
e6c779c67aa947c951f334f4f312bd2b21d27e55 (no-eol)
Try again with --non-forward-move.
$ hg push --to scratch/public --non-forward-move -r .
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 1 commit:
remote: 8bebbb8c3ae7 other1
$ cat $TESTTMP/server/.hg/scratchbranches/index/bookmarkmap/scratch/public
8bebbb8c3ae7d0404be1a13386747db4bc43806e (no-eol)
Move the two bookmarks back to a public commit.
$ hg push --to scratch/public --non-forward-move -r 'desc(base)'
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 0 commits:
$ hg push --to scratch/other --non-forward-move -r 'desc(commit1)'
pushing to ssh://user@dummy/server
searching for changes
remote: pushing 0 commits:
Update the public scratch bookmarks in the other client, using both -r and -B.
$ cd ../client2
$ hg log -r scratch/public -T '{node|short} "{desc}" {remotebookmarks}\n'
e6c779c67aa9 "commit1" default/scratch/public
$ hg pull -r scratch/public
pulling from ssh://user@dummy/server
no changes found
$ hg log -r scratch/public -T '{node|short} "{desc}" {remotebookmarks}\n'
d20a80d4def3 "base" default/scratch/public
$ hg pull -B scratch/other
pulling from ssh://user@dummy/server
no changes found
$ hg log -r scratch/other -T '{node|short} "{desc}" {remotebookmarks}\n'
e6c779c67aa9 "commit1" default/real-public default/scratch/other