This is an archive of the discontinued Mercurial Phabricator instance.

store: return just one filename in walk functions
ClosedPublic

Authored by valentin.gatienbaron on Aug 3 2021, 12:25 PM.

Details

Summary

Various walk functions return (revlog_type, decoded, encoded) where
decoded could be None. But no-one cares about encoded and expects
unencoded to be present, except verify (because this can only happen
with old repo formats).

Simplify all this by either failing outright if a decoding a filename
fails (instead of almost certainly failing with a type error due to
treating None as a bytes), or skipping the filename but providing in
an out argument for hg verify.

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

Alphare requested changes to this revision.Aug 24 2021, 10:27 AM
Alphare added a subscriber: Alphare.

This looks good aside from the gettext comment, but will (functionally) need to be rebased on top of 5.9 since the fix for issue6528 uses datafiles in mercurial/revlogutils/rewrite.py.

mercurial/store.py
589

This error message should use gettext (i.e. _())

This revision now requires changes to proceed.Aug 24 2021, 10:27 AM
Alphare requested changes to this revision.Aug 24 2021, 12:09 PM

I will amend both changes in-flight, don't bother.

mercurial/store.py
589

This does not pass black formatting.

tests/simplestorerepo.py
686

Should have been f1 instead of a1.

This revision now requires changes to proceed.Aug 24 2021, 12:09 PM
Alphare accepted this revision.Aug 24 2021, 12:10 PM
This revision is now accepted and ready to land.Aug 24 2021, 12:10 PM