mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Update dependencies and implement git-based sync direction defaults
- Updated `clap` and `unicode-ident` versions in `Cargo.lock` and `Cargo.toml`. - Added `sha1` crate to `Cargo.toml` for SHA1 hashing functionality. - Introduced a new `git.rs` module for handling git operations, including changed files and SHA1 computation. - Enhanced the sync confirmation dialog to auto-select defaults based on git status, improving user experience during two-way sync. - Updated `PatchTree` to utilize git metadata for determining default selections during patch application. These changes enhance the integration with git, providing smarter defaults and improving the overall sync process.
This commit is contained in:
parent
df22500102
commit
7ba04f7f6a
29 changed files with 1285 additions and 176 deletions
|
|
@ -653,10 +653,12 @@ function App:startSession()
|
|||
})
|
||||
end)
|
||||
|
||||
local cachedServerInfo = nil
|
||||
|
||||
self.cleanupPrecommit = serveSession:hookPrecommit(function(patch, instanceMap)
|
||||
-- Build new tree for patch
|
||||
local gitMetadata = cachedServerInfo and cachedServerInfo.gitMetadata
|
||||
self:setState({
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Old", "New" }),
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Old", "New" }, gitMetadata),
|
||||
})
|
||||
end)
|
||||
self.cleanupPostcommit = serveSession:hookPostcommit(function(patch, instanceMap, unappliedPatch)
|
||||
|
|
@ -790,6 +792,8 @@ function App:startSession()
|
|||
local initialSyncConfirmed = false
|
||||
|
||||
serveSession:setConfirmCallback(function(instanceMap, patch, serverInfo)
|
||||
cachedServerInfo = serverInfo
|
||||
|
||||
-- Filter out the DataModel name change from the patch
|
||||
-- The project name (DataModel.Name) is managed by Studio independently
|
||||
PatchSet.removeDataModelName(patch, instanceMap)
|
||||
|
|
@ -864,7 +868,7 @@ function App:startSession()
|
|||
})
|
||||
self:setState({
|
||||
appStatus = AppStatus.Confirming,
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Current", "Incoming" }),
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Current", "Incoming" }, serverInfo.gitMetadata),
|
||||
confirmData = {
|
||||
serverInfo = serverInfo,
|
||||
},
|
||||
|
|
@ -914,8 +918,9 @@ function App:startSession()
|
|||
-- Update the patchTree when new changes arrive during confirmation
|
||||
-- The changedIds parameter contains IDs of items that were modified
|
||||
-- so their selections can be reset (user must re-review)
|
||||
local gitMetadata = cachedServerInfo and cachedServerInfo.gitMetadata
|
||||
self:setState({
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Current", "Incoming" }),
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Current", "Incoming" }, gitMetadata),
|
||||
changedIds = changedIds, -- Pass to UI so it can unselect changed items
|
||||
})
|
||||
end)
|
||||
|
|
@ -1045,7 +1050,19 @@ function App:render()
|
|||
self.confirmationBindable:Fire("Abort")
|
||||
end,
|
||||
onConfirm = function(selections)
|
||||
self.confirmationBindable:Fire({ type = "Confirm", selections = selections })
|
||||
local autoSelectedIds = {}
|
||||
if self.state.patchTree then
|
||||
self.state.patchTree:forEach(function(node)
|
||||
if node.patchType and node.defaultSelection ~= nil then
|
||||
autoSelectedIds[node.id] = true
|
||||
end
|
||||
end)
|
||||
end
|
||||
self.confirmationBindable:Fire({
|
||||
type = "Confirm",
|
||||
selections = selections,
|
||||
autoSelectedIds = autoSelectedIds,
|
||||
})
|
||||
end,
|
||||
}),
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue