cli: spool patches to disk to avoid OOMs
Created by: LawnGnome
From #34943 (closed): we currently keep all pending patches in memory, which in the case of a very large batch change might result in src
being killed due to running out of memory.
We should spool the patches to disk, rather than keeping them in memory. Bonus points if we do this with a heuristic to only do this once the patches pass a certain threshold in memory.