Split get_diff_files into get_diff_files and populate_diff_chunks.
Review Request #3211 — Created July 13, 2012 and submitted
Split get_diff_files into get_diff_files and populate_diff_chunks. get_diff_files was set up to run in two possible modes. In one mode, it just fetched all the files and metadata that would be displayed in a diff viewer. In the other mode, it would do that and load diff chunks. Really, there was no reason to do both. It just made things more complicated. The information loading mode was nothing but database hits, so we had a certain known level of complexity there. The chunk loading code, however, was very expensive, and drastically changed what you would expect time-wise from the function. Now the chunk loading is done in populate_diff_chunks, which just iterates through the list of files provided by get_diff_files and loads the chunks for each. This is the first step in a series of changes I'm planning to make to restructure bits of the diff handling code to make it more extensible.
Tested loading diffs and chunks (expanding collapsed regions). All unit tests pass.
reviewboard/diffviewer/diffutils.py (Diff revision 1)
Can't this just be enumerate(chunks)?