sapling/eden/scm/tests/test-doctor.t
Jun Wu 27a1ffa9d1 tests: fix test-doctor.t on Windows
Summary:
On Windows the error message is different. In this test we only need to verify
a command fails. Therefore remove the output and only keep the exit code.

Reviewed By: xavierd

Differential Revision: D18915580

fbshipit-source-id: bd1031170335918d507e6225b02541ec52bc62fa
2019-12-10 14:45:43 -08:00

80 lines
1.8 KiB
Perl

#chg-compatible
(This test needs to re-run the hg process. Therefore hard to use single-process Python test)
Test indexedlogdatapack
$ . "$TESTDIR/library.sh"
$ newrepo master
$ setconfig remotefilelog.server=true remotefilelog.serverexpiration=-1
$ cd $TESTTMP
$ enable remotenames
$ setconfig remotefilelog.debug=false remotefilelog.indexedlogdatastore=true remotefilelog.fetchpacks=true
$ setconfig diff.git=true experimental.narrow-heads=true mutation.record=true mutation.enabled=true mutation.date="0 0" visibility.enabled=1
$ hgcloneshallow ssh://user@dummy/master shallow -q
$ cd shallow
Make some commits
$ drawdag << 'EOS'
> B C # amend: B -> C
> |/
> A
> EOS
When everything looks okay:
$ hg doctor
mutation: looks okay
metalog: looks okay
allheads: looks okay
indexedlogdatastore: looks okay
Break the repo in various ways:
$ echo x > $TESTTMP/hgcache/master/indexedlogdatastore/latest
$ echo y > $TESTTMP/hgcache/master/indexedlogdatastore/0/index-node.sum
$ mkdir -p .hg/store/mutation/
$ echo v > .hg/store/mutation/log
$ echo xx > .hg/store/metalog/blobs/index-id
$ echo xx > .hg/store/metalog/roots/meta
$ rm .hg/store/allheads/meta
Check the repo is broken (exit code is non-zero):
$ hg log -GpT '{desc}\n' &>/dev/null
[255]
Test that 'hg doctor' can fix them:
$ hg doctor
mutation: repaired
metalog: repaired
allheads: repaired
indexedlogdatastore: repaired
Check the repo is usable again:
$ hg log -GpT '{desc}\n'
o C
| diff --git a/C b/C
| new file mode 100644
| --- /dev/null
| +++ b/C
| @@ -0,0 +1,1 @@
| +C
| \ No newline at end of file
|
o A
diff --git a/A b/A
new file mode 100644
--- /dev/null
+++ b/A
@@ -0,0 +1,1 @@
+A
\ No newline at end of file