mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
98d9269874
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
175 lines
4.6 KiB
Perl
175 lines
4.6 KiB
Perl
#chg-compatible
|
|
|
|
$ . "$TESTDIR/hgsql/library.sh"
|
|
$ disable treemanifest
|
|
|
|
Populate the db with an initial commit
|
|
|
|
$ initclient client
|
|
$ cd client
|
|
$ echo x > x
|
|
$ hg commit -qAm x
|
|
$ echo y > y
|
|
$ hg commit -qAm y
|
|
$ hg up 0
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
$ echo z > z
|
|
$ hg commit -qAm z
|
|
$ hg bookmark foo
|
|
$ cd ..
|
|
|
|
Create two masters
|
|
|
|
$ initserver master masterrepo
|
|
$ initserver master2 masterrepo
|
|
$ cd master
|
|
$ hg log
|
|
$ hg pull -q ../client
|
|
|
|
$ cd ../master2
|
|
$ hg log -G -T '{desc} {bookmarks}\n'
|
|
o z foo
|
|
│
|
|
│ o y
|
|
├─╯
|
|
o x
|
|
|
|
|
|
Stripping normally should fail
|
|
|
|
$ hg debugstrip -r 1
|
|
transaction abort!
|
|
rollback completed
|
|
strip failed, backup bundle stored in '$TESTTMP/master2/.hg/strip-backup/d34c38483be9-3839604f-backup.hg'
|
|
strip failed, unrecovered changes stored in '$TESTTMP/master2/.hg/strip-backup/d34c38483be9-48128f20-temp.hg'
|
|
(fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/master2/.hg/strip-backup/d34c38483be9-48128f20-temp.hg'")
|
|
abort: invalid repo change - only hg push and pull are allowed
|
|
[255]
|
|
|
|
$ hg verify
|
|
unknown reference in .hg/bookmarks: foo bc3a71defa4a8fb6e8e5c192c02a26d94853d281
|
|
checking changesets
|
|
checking manifests
|
|
crosschecking files in changesets and manifests
|
|
checking files
|
|
3 files, 3 changesets, 3 total revisions
|
|
|
|
Strip using sqlstrip
|
|
|
|
- Test that specifying `--i-know-what-i-am-doing` is required.
|
|
$ hg sqlstrip 1
|
|
abort: You must pass --i-know-what-i-am-doing to run this command. If you have multiple servers using the database, this command will break your servers until you run it on each one. Only the Mercurial server admins should ever run this.
|
|
[255]
|
|
|
|
- Test that specifying the `--cwd` option works.
|
|
$ cd ..
|
|
$ hg --cwd master2 sqlstrip --i-know-what-i-am-doing 1
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
stripping locally
|
|
stripping from the database
|
|
deleting old references
|
|
deleting revision data
|
|
|
|
$ cd master2
|
|
|
|
Repull, and then strip without a backup
|
|
$ hg pull -q ../client
|
|
$ hg verify
|
|
checking changesets
|
|
checking manifests
|
|
crosschecking files in changesets and manifests
|
|
checking files
|
|
3 files, 3 changesets, 3 total revisions
|
|
|
|
$ hg log -G -T '{desc} {bookmarks}\n'
|
|
o z foo
|
|
│
|
|
│ o y
|
|
├─╯
|
|
o x
|
|
|
|
$ hg sqlstrip --i-know-what-i-am-doing 1 --no-backup-permanent-data-loss
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
*** *** *** *** *** *** *** *** * *** *** *** *** *** *** *** ***
|
|
*** THERE ARE NO BACKUPS! * (MANDATORY 10 SECOND WAIT) ***
|
|
*** *** *** *** *** *** *** *** * *** *** *** *** *** *** *** ***
|
|
stripping locally
|
|
stripping from the database
|
|
deleting old references
|
|
deleting revision data
|
|
|
|
Verify master2 is stripped
|
|
|
|
$ hg verify
|
|
checking changesets
|
|
checking manifests
|
|
crosschecking files in changesets and manifests
|
|
checking files
|
|
1 files, 1 changesets, 1 total revisions
|
|
$ hg log -G -T '{desc} {bookmarks}\n'
|
|
o x foo
|
|
|
|
Verify master is broken
|
|
|
|
$ cd ../master
|
|
$ hg log 2>&1 | egrep 'CorruptionException:'
|
|
*CorruptionException: tip doesn't match after sync (self: 2, fetchend: 0) (glob)
|
|
|
|
Run sqlstrip on master as well
|
|
|
|
$ hg sqlstrip --i-know-what-i-am-doing 1
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
stripping locally
|
|
stripping from the database
|
|
deleting old references
|
|
deleting revision data
|
|
|
|
$ hg verify
|
|
checking changesets
|
|
checking manifests
|
|
crosschecking files in changesets and manifests
|
|
checking files
|
|
1 files, 1 changesets, 1 total revisions
|
|
$ hg log -G -T '{desc} {bookmarks}\n'
|
|
o x foo
|
|
|
|
Commit after the strip
|
|
|
|
$ hg up -q 0
|
|
$ echo z > z
|
|
$ hg commit -qAm z
|
|
|
|
$ cd ../master2
|
|
$ hg log -G -T '{desc} {bookmarks}\n'
|
|
o z
|
|
│
|
|
o x foo
|
|
|
|
Attempt to strip a non-existant rev
|
|
|
|
$ hg sqlstrip --i-know-what-i-am-doing 5
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
abort: revision 5 is not in the repo
|
|
[255]
|
|
|
|
Attempt to strip a non-integer
|
|
|
|
$ hg sqlstrip --i-know-what-i-am-doing master
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
abort: specified rev must be an integer: 'master'
|
|
[255]
|
|
|
|
Strip everything. No revlog revisions should remain in the database:
|
|
|
|
$ hg sqlstrip --i-know-what-i-am-doing 0
|
|
*** YOU ARE ABOUT TO DELETE HISTORY (MANDATORY 5 SECOND WAIT) ***
|
|
stripping locally
|
|
stripping from the database
|
|
deleting old references
|
|
deleting revision data
|
|
$ mysql -h "$DBHOST" -P "$DBPORT" -u "$DBUSER" "$DBPASSOPT" "$DBNAME" <<"EOS"
|
|
> SELECT COUNT(1) FROM revisions WHERE repo='masterrepo'
|
|
> EOS
|
|
COUNT(1)
|
|
0
|