Summary:
Update the fixcorrupt extension to look back as far as necessary in the revlog
to find a good entry. Previously the user had to supply a good value using the
--checklen argument. If --checklen was too small, fixcorrupt could end up
trying to truncate in the middle of a corrupted section of the revlog, which
would cause problems as it was still using corrupted data.
This change ensures that fixcorrupt always looks back far enough to find a good
entry. We start by looking at the last 10 entries, and double that amount each
time the first item in the list is still bad.
Test Plan:
Used it to fix a corrupted fbsource repository where the corruption was 36
commits back.
Reviewers: #mercurial, quark, stash
Reviewed By: stash
Subscribers: stash, net-systems-diffs@fb.com, yogeshwer, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D4874243
Signature: t1:4874243:1492007518:7406b03a9967815a496a8c2fae394c5f21f7e60a
Summary:
`wc` in OSX has different padding behavior that breaks the test:
```
$ wc -c .hg/store/00changelog* .hg/store/00manifest* | sort
- 99 .hg/store/00manifest.d
- 110 .hg/store/00changelog.d
- 128 .hg/store/00changelog.i
- 128 .hg/store/00manifest.i
- 465 total
+ 99 .hg/store/00manifest.d
+ 110 .hg/store/00changelog.d
+ 128 .hg/store/00changelog.i
+ 128 .hg/store/00manifest.i
+ 465 total
```
This patch fixes it.
Test Plan: The fix was verified manually on an OS X machine.
Reviewers: #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D4872689
Signature: t1:4872689:1491954172:92178178deea88ec3545c42ad0cdecc8099a1db6
Summary:
We sometimes get reports about corrupted repos. Usually the corrupted part
is just at the end of changelog or manifest.
Truncating them manually works but people need to be very careful. This
extension is like the manual fix but automatized.
Test Plan:
Run `hg debugfixcorrupt --no-dryrun` on a reported corrupted repo and check
it truncates files correctly and the repo passes `hg verify` afterwards.
Reviewers: #mercurial, durham, stash
Reviewed By: stash
Subscribers: stash, rmcelroy, durham, lcharignon, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D3408396
Signature: t1:3408396:1491897232:fc17a105124b568963441adfec97e26735df3258