New EXPERIMENTAL command to sync file state with codebase#5030
Draft
ChrisPenner wants to merge 12 commits intotrunkfrom
Draft
New EXPERIMENTAL command to sync file state with codebase#5030ChrisPenner wants to merge 12 commits intotrunkfrom
ChrisPenner wants to merge 12 commits intotrunkfrom
Conversation
16cbd50 to
0adc6f3
Compare
Contributor
|
I'm thinking this could be very useful in an "I know that the normal workflow is broken for what I'm trying to do", and then I'd want to toggle it on just temporarily. Would it be hard to be able to toggle the mode without restarting ucm? |
Member
Author
|
@aryairani you don't need to swap the mode in order to use it, you can just call If we do want a command to switch the mode that's not hard either, but does add to the complexity of UCM a little bit. |
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.
Overview
We've run into a LOT of gotchas and unexpected fiddlyness in updates and deletes in UCM lately, in ways that make it quite difficult to deal with, and resulting in some non-ergonomic workflows (e.g. creating a new branch just to perform a delete).
As an experiment, this adds a new way of working with Unison codebases, more similar to traditional approaches.
This workflow introduces a new mode to UCM wherein your scratchfile is treated as the complete collection of code in your project (except libs). Anything removed from the scratch file will be treated as a
deletefrom the codebase if youcommitthat version of the scratchfile.I.e. it compiles your scratchfile just like it were a source file in any other programming language.
This allows you to do things like type-changing record field updates or deletes without UCM giving you grief when you try to
updateit, and also allows you to immediately parse & compile your whole project with a given set of changes without needing to iteratively propagate them into your codebase one bit at a time.This is still very much just an experimental prototype, and likely to be a little broken in some ways, so tread lightly.
Known issues:
Implementation notes
Adds a new command
experimental.commit(name not finalized, and clearly experimental).Adds new command
experimental.commit.previewwhich shows what ☝🏼 WOULD do.Adds environment variable, you can set
UNISON_LOAD_MODE=committo switch UCM's default typecheck-on-save mode to match what the commit command does.The commit command is implemented by:
parsing the scratchfile with ONLY libs in scope
When committing, add all the definitions from the scratch-file to a branch containing only the libs of the current project.
Display a namespace diff of the old branch to the new one to show what changed.
This means no update propagations are needed, you handle them in the scratchfile while making the initial change.
Interesting/controversial decisions
Pretty sure this whole thing is interesting and/or controversial.
Test coverage
Added a transcript, but this probably needs a lot more testing in real-world situations.
Loose ends
This was a timeboxed experiment with a whole new paradigm, so the result is still a bit rough; things to add if we decide to invest more time:
edit.namespaceto not include record field accessors.