-
Notifications
You must be signed in to change notification settings - Fork 372
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
Opam file with preserved format more precise #4302
Conversation
I've used this branch to make ocaml/opam-repository#17428 and it worked perfectly aside from one weird bug:
Aside from that it was almost perfect (a few spaces were removed for the line being modified but the rest did not move and it feels so good! Thanks for this! 🎉 |
Very neat job indeed. Just a question remakr: we used to split conflicts on multiple lines otherwise the constraints were not correctly interpreted. Is this still an issue? If so, the tool is not splitting the conflicts on different lines, so that will need to be addressed as well |
Please ignore my comment, I tested it locally and the |
Thanks for the tests! |
I haven't tried but would that also erase potential comments put at the end of the line being updated? |
From what I remember, it should keep them... |
This PR seems to have an unexpected effect on I would guess they need some kind of way in the API to say "remove this comment" or something like that now with this change. cc @NathanReb |
Btw changes some API bits used in dune-release. Here is the change I had to make to |
Comments: As the new version is more precise, it doesn't remove comments as before. It is indeed possible, in the function |
dune-release only needs the API so it would be perfect! |
Ok, i'll add it then. Not that it will also remove all authors comments, not only dune ones. |
Following an offline discussion with @kit-ty-kate it seems that the ideal behaviour in dune-release would be to remove only the dune comment. Any thoughts on this? If we agree that's the case then it's probably better to let dune-release filter out that comment. That will preserve other comments and allow dune-release code to be compatible with both 2.1 and 2.0 without conditional builds based on the opam version. |
Ah nevermind my comment, the API already changes in a breaking way! In that case then yeah indeed, being able to drop all comments seems fine, it will preserve dune-release's behaviour between opam 2.0 and 2.1. We'll have to maintain compat between the two versions anyway! |
Thinking about it, It is more consistent (imho) for dune-release to remove the the dune comment than for opam to remove all comment just for one targeted line. |
If I understood this correclty, If we want to change dune-release to include other comments we can take care of it later on and indeed this will probably require dune-release to strip the dune comment itself as I don't think it makes sense for opam to allow modifying comments in the |
The origin of this PR is that |
And yes, if it's ok for |
no comment function ping @NathanReb @kit-ty-kate |
In fact, I don't think that the |
…'t drop comments, etc.
Good to go for me |
Fixes #3993. To not merge before #4298
To take the same example, with
opam admin add-constraint dune>=1.11
:to