sapling/eden/hg-server/tests/test-infinitepush-scratchbookmark-commands.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

241 lines
6.1 KiB
Perl

#chg-compatible
$ disable treemanifest
$ configure dummyssh
Common configuration for both the server and client.
$ enable infinitepush remotenames
$ setconfig infinitepush.branchpattern="re:scratch/.+"
Initialize the server.
$ newrepo server
$ setconfig infinitepush.server=yes infinitepush.indextype=disk \
> infinitepush.storetype=disk phases.new-commit="public"
Make some commits on the server.
$ echo base > base
$ hg commit -Aqm "public commit"
$ echo 1 > file
$ hg commit -Aqm "another public commit"
Initialize the client.
$ cd $TESTTMP
$ hg clone -q ssh://user@dummy/server client
$ cd client
Push a public commit to a scratch bookmark.
$ hg push -q --to "scratch/public" --create -r "."
Push a draft commit to a scratch bookmark.
$ echo 2 > file
$ hg commit -Aqm "draft commit"
$ hg push -q --to "scratch/draft" --create -r "."
Test invalid invocations of the `debugcreatescratchbookmark` command.
$ hg debugcreatescratchbookmark -r "." -B scratch/bookmark
abort: scratch bookmarks can only be created on an infinitepush server
[255]
$ cd ../server
$ hg debugcreatescratchbookmark -r "all()" -B scratch/bookmark
abort: must specify exactly one target commit for scratch bookmark
[255]
$ hg debugcreatescratchbookmark -r "."
abort: scratch bookmark name is required
[255]
Make another public scratch bookmark on an older commit on the server.
$ hg debugcreatescratchbookmark -r "." -B scratch/anotherpublic
Test that we cannot create a scratch bookmark with the same name.
$ hg debugcreatescratchbookmark -r "." -B scratch/anotherpublic
abort: scratch bookmark 'scratch/anotherpublic' already exists
[255]
Test that we cannot create a real bookmark.
$ hg debugcreatescratchbookmark -r "." -B nonscratchbookmark
abort: invalid scratch bookmark name
[255]
Check that the bookmarks show as expected on the client.
$ cd ../client
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit"
72feb0cc373f "another public commit" default/scratch/public
68d8ff913700 "draft commit" default/scratch/draft
$ hg pull -B scratch/anotherpublic
pulling from ssh://user@dummy/server
no changes found
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit"
72feb0cc373f "another public commit" default/scratch/anotherpublic default/scratch/public
68d8ff913700 "draft commit" default/scratch/draft
Make another scratch bookmark on a draft commit on the server.
$ cd ../server
$ hg debugcreatescratchbookmark -r "68d8ff913700" -B scratch/anotherdraft
Check that the draft scratch bookmark shows up on the client as expected.
$ cd ../client
$ hg pull -r scratch/anotherdraft
pulling from ssh://user@dummy/server
no changes found
adding changesets
adding manifests
adding file changes
added 0 changesets with 0 changes to 1 files
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit"
72feb0cc373f "another public commit" default/scratch/anotherpublic default/scratch/public
68d8ff913700 "draft commit" default/scratch/anotherdraft default/scratch/draft
Test the attempting to create a scratch bookmark on a non existing commit fails.
$ cd ../server
$ hg debugcreatescratchbookmark -r "aaaaaaaaaaaa" -B scratch/bookmark
abort: unknown revision 'aaaaaaaaaaaa'!
[255]
Test invalid invocations of the `debugmovescratchbookmark` command.
$ cd ../client
$ hg debugmovescratchbookmark -r "." -B scratch/draft
abort: scratch bookmarks can only be moved on an infinitepush server
[255]
$ cd ../server
$ hg debugmovescratchbookmark -r "all()" -B scratch/draft
abort: must specify exactly one target commit for scratch bookmark
[255]
$ hg debugmovescratchbookmark -r "."
abort: scratch bookmark name is required
[255]
$ hg debugmovescratchbookmark -r "." -B scratch/nonexistingbookmark
abort: scratch bookmark 'scratch/nonexistingbookmark' does not exist
[255]
Test that we cannot move a real bookmark.
$ hg debugmovescratchbookmark -r "." -B nonscratchbookmark
abort: invalid scratch bookmark name
[255]
Move a public scratch bookmark to an older commit on the server.
$ hg debugmovescratchbookmark -r ".^" -B scratch/public
Check that the bookmarks show as expected on the client.
$ cd ../client
$ hg pull -B scratch/public
pulling from ssh://user@dummy/server
no changes found
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit" default/scratch/public
72feb0cc373f "another public commit" default/scratch/anotherpublic
68d8ff913700 "draft commit" default/scratch/anotherdraft default/scratch/draft
Push another draft commit to a scratch bookmark.
$ echo 2 >> file
$ hg commit -Aqm "another draft commit"
$ hg push -q --to "scratch/draft" -r "."
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit" default/scratch/public
72feb0cc373f "another public commit" default/scratch/anotherpublic
68d8ff913700 "draft commit" default/scratch/anotherdraft
6051090c9df8 "another draft commit" default/scratch/draft
Swap the draft scratch bookmarks.
$ cd ../server
$ hg debugmovescratchbookmark -r "68d8ff913700" -B scratch/draft
$ hg debugmovescratchbookmark -r "6051090c9df8" -B scratch/anotherdraft
Check that the bookmarks show as expected on the client.
$ cd ../client
$ hg pull -B scratch/draft
pulling from ssh://user@dummy/server
no changes found
adding changesets
adding manifests
adding file changes
added 0 changesets with 0 changes to 1 files
$ hg pull -B scratch/anotherdraft
pulling from ssh://user@dummy/server
no changes found
adding changesets
adding manifests
adding file changes
added 0 changesets with 0 changes to 1 files
$ hg log -r "all()" -T '{node|short} "{desc}" {remotebookmarks}\n'
74903ee2450a "public commit" default/scratch/public
72feb0cc373f "another public commit" default/scratch/anotherpublic
68d8ff913700 "draft commit" default/scratch/draft
6051090c9df8 "another draft commit" default/scratch/anotherdraft