HomePhabricator

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

Authored by mharbison72.

Description

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

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.

Differential Revision: https://phab.mercurial-scm.org/D8220