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
feat: better merge algorithm #4910
Conversation
Tip: Use `merge /topic1 /main` to merge your work back into | ||
the main branch. | ||
Tip: To merge your work back into the main branch, first | ||
`switch /main` then `merge /topic1`. | ||
|
||
foo/main> branch /topic2 | ||
|
||
Done. I've created the topic2 branch based off of main. |
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 issue, but maybe we want to use the slash syntax here too?
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.
I don't think so; the slash isn't part of the branch name. Maybe that's also an argument against using it in the "I merged /bob into /alice" output message 🤔
& UF.hashTermsId | ||
& Map.toList | ||
& mapMaybe \(var, (_, ref, wk, _, _)) -> do | ||
guard (WK.watchKindShouldBeStoredInDatabase wk) |
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.
What's this guard about?
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.
It's keeping only these:
foo = ...
test> bar = ...
but not
> hey
nor
wat> x = ...
This reverts commit 9afdce5.
Co-authored-by: Arya Irani <538571+aryairani@users.noreply.github.com>
Co-authored-by: Arya Irani <538571+aryairani@users.noreply.github.com>
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.
I still owe a more detailed review later, but this is at least great and I wanna avoid more merge conflicts
Yay!!!!! |
This PR contains the MVP / minimal thing / version 0 of the new merge algorithm.
See merge.output.md for an overview of its behavior.
In summary, we diff namespaces based on "syntactic hashes" in which a pretty-print environment renders references before hashing. This is the mechanism by which we distinguish "user changes" from auto-propagated changes.
There are a number of different preconditions that each namespace (and their LCA) must satisfy before we can attempt a merge, such as having no conflicted names, and having exactly one properly-placed name for each constructor of a particular naming of a data declaration. See the above transcript for more details.
A couple outstanding things:
merge
still exists (hidden) asmerge.old
. Thepull
command still performs amerge.old
after downloading entities, not amerge
.merge.preview
normerge.squash
. Those still exist asmerge.old.preview
andmerge.old.squash
.merge
to instruct the user on how to resolve #4928And a note about the code quality:
honk
,bonk
, and perhapsoink
. However, none of it was feeling like it should block the review of this PR. I plan to continue to refine things in the upcoming days.