upgrade: extract the checking of target requirements change
This logic is fairly independant, lets move it out of the main function.
Differential Revision: https://phab.mercurial-scm.org/D9485
#require black test-repo $ cd $RUNTESTDIR/.. $ black --config=black.toml --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/**'`