mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 22:11:38 +00:00
Update deduplication logic and documentation for suffix handling
- Removed the `luau` dependency from `rokit.toml`. - Updated deduplication logic to append `~2`, `~3`, etc. instead of `~1`, `~2` for naming collisions in various files, ensuring consistent suffix management. - Adjusted comments and documentation across multiple files to reflect the new suffix handling rules. - Added new test cases to validate the updated deduplication behavior, ensuring accurate naming for instances with collisions. These changes enhance the clarity and functionality of the deduplication process, improving overall consistency in naming conventions.
This commit is contained in:
parent
a59d9d497a
commit
d836ebddc8
35 changed files with 349 additions and 281 deletions
|
|
@ -79,8 +79,9 @@ function Tree.new()
|
|||
local tree = {
|
||||
idToNode = {},
|
||||
ROOT = {
|
||||
id = "ROOT",
|
||||
className = "DataModel",
|
||||
name = "ROOT",
|
||||
name = "game",
|
||||
children = {},
|
||||
},
|
||||
}
|
||||
|
|
@ -209,6 +210,41 @@ function Tree:buildAncestryNodes(previousId: string?, ancestryIds: { string }, p
|
|||
end
|
||||
end
|
||||
|
||||
local function computeRootChangeInfo(tree)
|
||||
local totalLinesAdded = 0
|
||||
local totalLinesRemoved = 0
|
||||
local totalPropChanges = 0
|
||||
local hasLineData = false
|
||||
|
||||
tree:forEach(function(node)
|
||||
if not node.changeInfo then
|
||||
return
|
||||
end
|
||||
if node.changeInfo.linesAdded then
|
||||
totalLinesAdded += node.changeInfo.linesAdded
|
||||
hasLineData = true
|
||||
end
|
||||
if node.changeInfo.linesRemoved then
|
||||
totalLinesRemoved += node.changeInfo.linesRemoved
|
||||
hasLineData = true
|
||||
end
|
||||
if node.changeInfo.propChanges then
|
||||
totalPropChanges += node.changeInfo.propChanges
|
||||
end
|
||||
end)
|
||||
|
||||
if not hasLineData and totalPropChanges == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
linesAdded = if hasLineData then totalLinesAdded else nil,
|
||||
linesRemoved = if hasLineData then totalLinesRemoved else nil,
|
||||
isWhitespaceOnly = false,
|
||||
propChanges = if totalPropChanges > 0 then totalPropChanges else nil,
|
||||
}
|
||||
end
|
||||
|
||||
local PatchTree = {}
|
||||
|
||||
-- Builds a new tree from a patch and instanceMap
|
||||
|
|
@ -482,6 +518,8 @@ function PatchTree.build(patch, instanceMap, changeListHeaders, gitMetadata)
|
|||
end
|
||||
Timer.stop()
|
||||
|
||||
tree.ROOT.changeInfo = computeRootChangeInfo(tree)
|
||||
|
||||
Timer.stop()
|
||||
return tree
|
||||
end
|
||||
|
|
@ -653,6 +691,8 @@ function PatchTree.updateMetadata(tree, patch, instanceMap, unappliedPatch)
|
|||
end)
|
||||
Timer.stop()
|
||||
|
||||
tree.ROOT.changeInfo = computeRootChangeInfo(tree)
|
||||
|
||||
Timer.stop()
|
||||
return tree
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue