This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-v2: Add a zero-size error type for dirstate v2 parse errors
ClosedPublic

Authored by SimonSapin on May 19 2021, 12:37 PM.

Details

Summary

This error should only happen if Mercurial is buggy or the file is corrupted.
It indicates for example that:

  • A part of the file refers to another part, and the byte offset or item count would cause reading out of bounds, beyond the end of the file.
  • The byte for an entry state has an invalid value

When parsing becomes lazy, many more functions will return a Result with
this error. Making it zero-size reduces the work that the ? operator needs
to do to pass around the error value.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

SimonSapin created this revision.May 19 2021, 12:37 PM
baymax updated this revision to Diff 28172.May 21 2021, 4:37 AM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

Alphare requested changes to this revision.May 21 2021, 5:41 AM
Alphare added a subscriber: Alphare.

The commit message passes a threshold of typos that makes it very hard to read. The change looks ok though

This revision now requires changes to proceed.May 21 2021, 5:41 AM

Oof sorry about that. I’ll reword it.

SimonSapin edited the summary of this revision. (Show Details)May 21 2021, 6:54 AM
baymax updated this revision to Diff 28271.May 30 2021, 3:27 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

Alphare accepted this revision.May 31 2021, 3:41 AM
This revision is now accepted and ready to land.May 31 2021, 3:41 AM