Class DiffSummary

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.DiffSummary

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class DiffSummary extends Object
One-line size summary of a stored unified diff, for the change-records screen (U-07).

The diff itself was behind a collapsed <details>, so the single most important fact on a change-control screen — that a configuration change happened and roughly how big it was — cost a click per row. Expanding every row by default is not the answer either: a page holds up to 50 records and a config.xml diff runs to hundreds of lines, so 50 open diffs is a screen nobody can read. The compromise is that the shape of the change is always visible and only the body stays on demand.

Counting is purely textual and matches the format store/UnifiedDiff emits: a --- before / +++ after header, then hunks of @@ … @@, context lines and +/- lines. The two header lines are excluded by length (a bare --- or +++ is not a content line), and the "diff too large to store" placeholder contains no +/- lines at all, so it summarises as empty and the row simply shows the note.

  • Method Details

    • of

      public static String of(@CheckForNull String diff)
      Parameters:
      diff - the stored unified diff, possibly null
      Returns:
      "+12 / -3 lines", or an empty string when there is nothing countable