phabricator: refactor `phabread` to write all patches at once

Authored by mharbison72.


phabricator: refactor phabread to write all patches at once

This will be necessary to create a first class phabimport command. That
command requires a transaction, and will import all named patches within a
single transaction. But if Phabricator queries also happen within the
transaction, that leaves open the chance that an exception is raised, the
transaction is abandoned, and the next command that is run will complain about
needing to run hg recover.

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