-
Notifications
You must be signed in to change notification settings - Fork 454
Add ‘dune promotion show’ command and tests #12669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add ‘dune promotion show’ command and tests #12669
Conversation
|
@ElectreAAS do you want to try reviewing this one? |
ElectreAAS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
My only question was: didn't we already have this? isn't this supposed to be what dune promotion diff does?
well apparently not
thanks :)
|
I'll let @ElectreAAS review or merge this one. |
218c6ea to
17be9be
Compare
Implements a new command to display corrected file contents without applying the promotion. Users can now view what the promoted file would look like before deciding to promote. - Added 'show' subcommand to bin/promotion.ml - Exposed correction_file function in src/promote/diff_promotion.mli Tests still need to be added. Fixes ocaml#3883 Signed-off-by: Maxence Maury <[email protected]>
Add a new blackbox test to verify the behavior of the 'dune promotion show' command. The test covers common use cases and edge cases to make sure the command works as intended and doesn’t modify source files. It checks that: - corrected files are displayed after failed diffs - multiple files and missing promotions are handled properly - warnings appear for non-promotable or missing files - source files stay untouched after showing their content Signed-off-by: Maxence Maury <[email protected]>
Signed-off-by: Maxence Maury <[email protected]>
|
I just rebased on main and apparently fucked up something with Github, don't worry I'm on it ;) |
| let show_corrected_contents files_to_promote = | ||
| let open Fiber.O in | ||
| let files = Diff_promotion.load_db () |> Diff_promotion.filter_db files_to_promote in | ||
| Fiber.parallel_iter files ~f:(fun file -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to above fuck-up: this parallel_iter means that files will be iterated over in a non-deterministic order. I don't think performance is a concern here, we can just List.iter.
If you want parallelism, do what Diff_promotion.display does, and sort after creating what you want to print, then print in an orderly manner
Signed-off-by: Ambre Austen Suhamy <[email protected]>
17be9be to
a9b7a5c
Compare
|
Also as this is user-facing, a changes entry would be nice |
This PR introduces a new subcommand
dune promotion showthat lets usersview the corrected contents of files ready for promotion without modifying
them.
It also adds a blackbox test verifying key behaviors:
Fixes #3883