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

141 lines
4.4 KiB
Raku

#require py2
$ configure modern
$ newserver master
$ setconfig smallcommitmetadata.entrylimit=6
$ echo "a" > a ; hg add a ; hg commit -qAm a
$ echo "b" > b ; hg add b ; hg commit -qAm b
$ echo "c" > c ; hg add c ; hg commit -qAm c
$ hg log
commit: 177f92b77385
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: c
commit: d2ae7f538514
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
commit: cb9a9f314b8b
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
Add some metadata
$ hg debugsmallcommitmetadata -r cb9a9f314b8b -c toomanyondisk willbetruncated
$ hg debugsmallcommitmetadata -r cb9a9f314b8b -c acategory avalue_willbeevicted
$ hg debugsmallcommitmetadata -r d2ae7f538514 -c bcategory bvalue
$ hg debugsmallcommitmetadata -r 177f92b77385 -c ccategory cvalue
$ hg debugsmallcommitmetadata -r cb9a9f314b8b -c abccategory avalue
$ hg debugsmallcommitmetadata -r d2ae7f538514 -c abccategory bvalue
Verify basic and JSON output:
$ hg debugsmallcommitmetadata
Found the following entries:
cb9a9f314b8b toomanyondisk: 'willbetruncated'
cb9a9f314b8b acategory: 'avalue_willbeevicted'
d2ae7f538514 bcategory: 'bvalue'
177f92b77385 ccategory: 'cvalue'
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
$ hg debugsmallcommitmetadata --template json
[
{
"category": "toomanyondisk",
"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
"value": "willbetruncated"
},
{
"category": "acategory",
"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
"value": "avalue_willbeevicted"
},
{
"category": "bcategory",
"node": "d2ae7f538514cd87c17547b0de4cea71fe1af9fb",
"value": "bvalue"
},
{
"category": "ccategory",
"node": "177f92b773850b59254aa5e923436f921b55483b",
"value": "cvalue"
},
{
"category": "abccategory",
"node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b",
"value": "avalue"
},
{
"category": "abccategory",
"node": "d2ae7f538514cd87c17547b0de4cea71fe1af9fb",
"value": "bvalue"
}
]
Verify that the limit is enforced properly.
$ setconfig smallcommitmetadata.entrylimit=5
$ hg debugsmallcommitmetadata
Found the following entries:
cb9a9f314b8b acategory: 'avalue_willbeevicted'
d2ae7f538514 bcategory: 'bvalue'
177f92b77385 ccategory: 'cvalue'
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
$ hg debugsmallcommitmetadata -r 177f92b77385 -c abccategory cvalue
Evicted the following entry to stay below limit:
cb9a9f314b8b acategory: 'avalue_willbeevicted'
$ hg debugsmallcommitmetadata
Found the following entries:
d2ae7f538514 bcategory: 'bvalue'
177f92b77385 ccategory: 'cvalue'
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
177f92b77385 abccategory: 'cvalue'
Verify that reads work correctly
$ hg debugsmallcommitmetadata -r d2ae7f538514 -c bcategory
Found the following entry:
d2ae7f538514 bcategory: 'bvalue'
$ hg debugsmallcommitmetadata -r cb9a9f314b8b
Found the following entries:
cb9a9f314b8b abccategory: 'avalue'
$ hg debugsmallcommitmetadata -c ccategory
Found the following entries:
177f92b77385 ccategory: 'cvalue'
$ hg debugsmallcommitmetadata -c abccategory
Found the following entries:
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
177f92b77385 abccategory: 'cvalue'
Verify that deletes work correctly
$ hg debugsmallcommitmetadata -d -r d2ae7f538514 -c bcategory
Deleted the following entry:
d2ae7f538514 bcategory: 'bvalue'
$ hg debugsmallcommitmetadata
Found the following entries:
177f92b77385 ccategory: 'cvalue'
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
177f92b77385 abccategory: 'cvalue'
$ hg debugsmallcommitmetadata -d -c abccategory
Deleted the following entries:
cb9a9f314b8b abccategory: 'avalue'
d2ae7f538514 abccategory: 'bvalue'
177f92b77385 abccategory: 'cvalue'
$ hg debugsmallcommitmetadata
Found the following entries:
177f92b77385 ccategory: 'cvalue'
$ hg debugsmallcommitmetadata -d -r 177f92b77385
Deleted the following entries:
177f92b77385 ccategory: 'cvalue'
$ hg debugsmallcommitmetadata
Found the following entries:
$ hg debugsmallcommitmetadata -d
Deleted the following entries:
$ hg debugsmallcommitmetadata
Found the following entries: