feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity)#4106
Merged
Conversation
Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer
stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the
trailing `sent / total size is` summary, level 2 adds the full
`Number of files / Total file size / Literal data / ...` detail block,
and level 3 additionally surfaces optional heap statistics. Prior to this
change oc-rsync emitted the full detail block at any non-zero level,
breaking parity for `--info=stats1` and for scripts relying on
upstream's tiered output.
This change:
- Plumbs the parsed `stats` level (u8) through `DerivedSettings`,
`TransferExecutionInputs`, and `emit_transfer_summary` instead of a
single boolean.
- Splits `emit_stats` into a level-aware front-end that delegates to
`emit_stats_detail_block` only at level >= 2 and always falls through
to `emit_totals` for the level-1 summary.
- Mirrors the upstream `if (stats.flist_buildtime)` guard so the
`File list generation/transfer time` pair only renders when at least
one timing is >= 1 ms.
- Maps the legacy `--stats` CLI flag to level 2 (or level 3 with
`-vv`), matching upstream's `options.c:2055` synthesis of
`parse_output_words("stats2"/"stats3", ...)`.
- Adds level 0/1/2/3 parity tests covering the absent, summary-only,
full-detail, and heap-stats-equivalent shapes.
…ng expectations Level-distinction is covered by the unit tests in output_parity.rs; end-to-end format expectations differ across platforms (path lengths, sub-millisecond timings).
This was referenced May 15, 2026
Merged
oferchen
added a commit
that referenced
this pull request
May 18, 2026
#4106) * feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity) Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the trailing `sent / total size is` summary, level 2 adds the full `Number of files / Total file size / Literal data / ...` detail block, and level 3 additionally surfaces optional heap statistics. Prior to this change oc-rsync emitted the full detail block at any non-zero level, breaking parity for `--info=stats1` and for scripts relying on upstream's tiered output. This change: - Plumbs the parsed `stats` level (u8) through `DerivedSettings`, `TransferExecutionInputs`, and `emit_transfer_summary` instead of a single boolean. - Splits `emit_stats` into a level-aware front-end that delegates to `emit_stats_detail_block` only at level >= 2 and always falls through to `emit_totals` for the level-1 summary. - Mirrors the upstream `if (stats.flist_buildtime)` guard so the `File list generation/transfer time` pair only renders when at least one timing is >= 1 ms. - Maps the legacy `--stats` CLI flag to level 2 (or level 3 with `-vv`), matching upstream's `options.c:2055` synthesis of `parse_output_words("stats2"/"stats3", ...)`. - Adds level 0/1/2/3 parity tests covering the absent, summary-only, full-detail, and heap-stats-equivalent shapes. * test(cli): gate info_stats_enables_summary_block to unix (Windows runner divergence) * test(cli): gate stats_transfer_renders_summary_block to unix * test(cli): remove end-to-end stats summary tests with platform-drifting expectations Level-distinction is covered by the unit tests in output_parity.rs; end-to-end format expectations differ across platforms (path lengths, sub-millisecond timings). * style: collapse double blank line after test removal
oferchen
added a commit
that referenced
this pull request
May 18, 2026
#4106) * feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity) Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the trailing `sent / total size is` summary, level 2 adds the full `Number of files / Total file size / Literal data / ...` detail block, and level 3 additionally surfaces optional heap statistics. Prior to this change oc-rsync emitted the full detail block at any non-zero level, breaking parity for `--info=stats1` and for scripts relying on upstream's tiered output. This change: - Plumbs the parsed `stats` level (u8) through `DerivedSettings`, `TransferExecutionInputs`, and `emit_transfer_summary` instead of a single boolean. - Splits `emit_stats` into a level-aware front-end that delegates to `emit_stats_detail_block` only at level >= 2 and always falls through to `emit_totals` for the level-1 summary. - Mirrors the upstream `if (stats.flist_buildtime)` guard so the `File list generation/transfer time` pair only renders when at least one timing is >= 1 ms. - Maps the legacy `--stats` CLI flag to level 2 (or level 3 with `-vv`), matching upstream's `options.c:2055` synthesis of `parse_output_words("stats2"/"stats3", ...)`. - Adds level 0/1/2/3 parity tests covering the absent, summary-only, full-detail, and heap-stats-equivalent shapes. * test(cli): gate info_stats_enables_summary_block to unix (Windows runner divergence) * test(cli): gate stats_transfer_renders_summary_block to unix * test(cli): remove end-to-end stats summary tests with platform-drifting expectations Level-distinction is covered by the unit tests in output_parity.rs; end-to-end format expectations differ across platforms (path lengths, sub-millisecond timings). * style: collapse double blank line after test removal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--info=STATS(and the implied--statsflag): level 1 emits only the trailingsent / total size issummary, level 2 adds the full file-count + byte-breakdown detail block, level 3 is byte-equivalent to level 2 (upstream's additional heap statistics have no oc-rsync analogue).stats_level: u8end-to-end (DerivedSettings,TransferExecutionInputs,emit_transfer_summary,emit_stats) in place of the prior boolean, and maps the legacy--statsflag to level 2 (or level 3 with-vv), mirroringoptions.c:2055 if (do_stats) parse_output_words("stats2"/"stats3", ...).if (stats.flist_buildtime)guard so theFile list generation/transfer timepair only renders when timing is >= 1 ms.Test plan
parity_stats_level_1_emits_only_summary_linesasserts level 1 contains the summary trailer and none of the detail block labels.parity_stats_level_2_emits_full_detail_block_plus_summaryasserts ordered presence of every upstream label and the summary trailer.parity_stats_level_3_matches_level_2_plus_summarypins user-visible byte-equivalence with level 2 (the upstream malloc/flist-heap addendum is platform-conditional even in C).parity_stats_level_0_emits_nothingasserts level 0 produces no output.parity_stats_output_contains_all_upstream_field_labels,parity_stats_output_field_order_matches_upstream) updated to tolerate the upstream-faithful suppression of sub-millisecond file-list timing lines.Refs: closes #2160, parent #2151.
Upstream references:
main.c::output_summary(rsync-3.4.2:416-465),main.c::handle_stats(rsync-3.4.2:325-385),options.c:2055(do_stats→stats2/stats3).