Download raw body.
add diffstat option to got log and tog diff view
On Wed, Jan 04, 2023 at 03:11:35AM +1100, Mark Jamsek wrote: > I often want to get a birdseye view of the changes in terms of total +/- > for a given commit. The below diff adds the -d flag to 'got log' and the > 'D' keymap to tog diff to display the number of lines added/removed for > each file changed in the commit, and a summary line showing the total > change across all files. But the implementation looks forward to making > the diffstat available to 'got diff' too. > > Although we have to compute the diff twice because the file changeset is > output before the diff is computed and we need the diff to display the > diffstat with the changeset, the performance impact is negligible for > the average commit because we don't pay the high cost of formatting any > output, we just want the diffreg_result so we can sum the changes. At > the high end, the average increase in a 675k line diff is approximately > 33% (i.e., 1.5 -> 2s), but for typical commits it's barely perceptible. > > That said, if it's a concern, we could probably look at holding onto the > diff result for the actual diff output, in which case there'd be no > extra cost. > > I opted to keep the diffstat output simple; for example: Very nice. I like the short way of displaying this data. ok by me. I would suggest to always turn this on in tog, replacing the -P style path list display. And leave it off by default on the command line. If this becomes a burdensome performance problem, we can look at ways to speed it up or disable it by default. Keeping diff_result around is a possible optimization that has been mentioned before. Our current high-level diff APIs don't expose the diff_result, which is suboptimal. We could add an extra set of API which expose it, or change the existing APIs to follow the computation/output split that is present in the diff.git API.
add diffstat option to got log and tog diff view