cleanupnodes: preserve phase of parents of new nodes
As Yuya noted in the review of D3818, passing in
targetphase=phases.draft would result in advancing the phase boundary
of a secret-phase parent. We never pass targetphase=phases.draft so
far, but it's a bug waiting to happen.
I tried to refactor it so max(parentphase, X) happened in one place,
but I couldn't come up with good variables names and I ended up with a
"newphase = max(newphase, parentphase)" line, which made the whole
block not look any better to me.
Differential Revision: https://phab.mercurial-scm.org/D3824
Our full contribution guidelines are in our wiki, please see:
https://www.mercurial-scm.org/wiki/ContributingChanges
If you just want a checklist to follow, you can go straight to
https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist
If you can't run the entire testsuite for some reason (it can be
difficult on Windows), please at least run `contrib/check-code.py` on
any files you've modified and run `python contrib/check-commit` on any
commits you've made (for example, `python contrib/check-commit
273ce12ad8f1` will report some style violations on a very old commit).