sapling/eden/hg-server/tests/test-commitcloud-backup-remotenames-public.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

118 lines
2.8 KiB
Perl

#chg-compatible
$ disable treemanifest
Remotenames extension has a shortcut that makes heads discovery work faster.
Unfortunately that may result in sending public commits to the server. This
test covers the issue.
$ . $TESTDIR/library.sh
$ . $TESTDIR/infinitepush/library.sh
$ enable remotenames
$ setupcommon
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -m "$1"
> }
$ scratchnodes() {
> for node in `find ../repo/.hg/scratchbranches/index/nodemap/* | sort`; do
> echo ${node##*/}
> done
> }
$ scratchbookmarks() {
> for bookmark in `find ../repo/.hg/scratchbranches/index/bookmarkmap/* -type f | sort`; do
> echo "${bookmark##*/bookmarkmap/} `cat $bookmark`"
> done
> }
Setup server with a few commits and one remote bookmark. This remotebookmark
may be used by remotenames extension in fastheaddiscovery heuristic
$ hg init repo
$ cd repo
$ setupserver
$ mkcommit first
$ hg book remotebook
$ hg up -q .
$ mkcommit second
$ mkcommit third
$ mkcommit fourth
$ hg bookmark master
$ cd ..
Create new client
$ hg clone ssh://user@dummy/repo --config extensions.remotenames= client -q
$ cd client
Create scratch commit and back it up.
$ hg up -q -r 'desc(third)'
$ mkcommit scratch
$ hg log -r . -T '{node}\n'
ce87a066ebc28045311cd1272f5edc0ed80d5b1c
$ hg log --graph -T '{desc}'
@ scratch
o fourth
o third
o second
o first
$ hg cloud backup
backing up stack rooted at ce87a066ebc2
commitcloud: backed up 1 commit
remote: pushing 1 commit:
remote: ce87a066ebc2 scratch
$ cd ..
Create second client
$ hg clone ssh://user@dummy/repo --config extensions.remotenames= client2 -q
$ cd client2
$ enable remotenames
Pull to get remote names
$ hg pull
pulling from ssh://user@dummy/repo
searching for changes
no changes found
$ hg book --remote
default/master 05fb75d88dcd
default/remotebook b75a450e74d5
Strip public commits from the repo, otherwise fastheaddiscovery heuristic will
be skipped
$ hg debugstrip -q -r 'desc(second):'
$ hg log --graph -T '{desc}'
@ first
Download scratch commit. It also downloads a few public commits
$ hg up -q ce87a066ebc28045311cd1272f5edc0ed80d5b1c
$ hg log --graph -T '{desc}'
@ scratch
o fourth
o third
o second
o first
$ hg book --remote
default/master 05fb75d88dcd
default/remotebook b75a450e74d5
Run cloud backup and make sure only scratch commits are backed up.
$ hg cloud backup
nothing to back up
$ mkcommit scratch2
$ hg cloud backup
backing up stack rooted at ce87a066ebc2
commitcloud: backed up 1 commit
remote: pushing 2 commits:
remote: ce87a066ebc2 scratch
remote: 4dbf2c8dd7d9 scratch2