canonicalize libnames for synhashing #6020
Draft
+163
−8
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
This PR implements a simple "canonicalize names" step before synhashing (for diff / merge calculations). The intention is to make changes to library dependencies (i.e. upgrades) register as propagated updates.
The existing (trunk) implementation of synhashing, omitting a couple minor details, considers two terms synhash-equal if they render the same (without suffixification).
That mostly works, but not for when one branch swaps out one library for another whilst also changing the library's name (e.g.
lib.base_1_0_0->lib.base_2_0_0).In this PR, we simply form a canonicalization step (for the pretty-print environment used in synhashing) for names of the form
lib.*_X_Y_Z.*, whereX,Y, andZare numbers. For example,lib.base_1_0_0.data.List.mapgets canonicalized tolib.base.data.List.map. This matches how we mangle released libraries with semantic version numbers.Test coverage
I added a transcript to
branch.diff.mdto demonstrate that we don't classify library upgrades as propagated updates, when the library names fit the_X_Y_Zmold. I also inspected synhashes manually at the command line.