Page MenuHomePhabricator

phabricator: don't infer the old `fctx` in `notutf8()`
ClosedPublic

Authored by mharbison72 on Mar 4 2020, 11:56 AM.

Details

Summary

This is used along with fctx.isbinary() to gate addoldbinary(), so it seems
like a good idea to provide the caller similar control over the current and
parent filecontext. Unlike addoldbinary(), it doesn't need both previous and
current contexts at the same time, so make the caller responsible for testing
both cases, as appropriate. I haven't worked out all of the problems around
marking files as binary for move/remove/copy, but this will definitely help with
--no-stack too.

It also turns out to have been doing too much- in the remove case, it tested not
just the removed file in the parent context (which is what gets passed in that
case), but also in the parent of the parent context (which should be
irrelevant). The previous code also required the fctx.parents() check to work
in the add (but without rename) case. Now the add and remove cases test only
what they need to. But now that it is written this way, the fact that only the
current fctx is checked to be binary in the case of modification or being
renamed seems wrong.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

mharbison72 created this revision.Mar 4 2020, 11:56 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.