censor: extract the part about creating and opening new files in a function
The v2_censor function is huge, now that its content has settled a bit it is a
good time to split individual part inside dedicated function.
The last part is the file copying and opening logic. It now have its own
function.
Differential Revision: https://phab.mercurial-scm.org/D10901
\{
"node": {node|json},
"changeset_count": {changesets|json},
"changesets": [{join(entries%changelistentry, ", ")}]
}