Skip to content

Commit 83cda4b

Browse files
committed
handle deletion in incremental load PullEventHandler
1 parent d72def8 commit 83cda4b

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Performance improvements (#269, #315)
1717
- Checkout of branches whose names contain slashes via Web UI no longer fails (#295)
1818
- Display other developer's username in Web UI's Workspace when hovering over the name of a file they changed (#304)
19+
- Incremental load PullEventHandler now handles file deletion (#299)
20+
- Incremental load PullEventHandler no longer returns a Success Status if an error was thrown during the pull process (#300)
1921

2022
## [2.3.0] - 2023-12-06
2123

cls/SourceControl/Git/Extension.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Method OnBeforeDelete(InternalName As %String) As %Status
275275
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
276276
set InternalName = ##class(Utils).NormalizeInternalName(InternalName)
277277
set Filename = ##class(Utils).FullExternalName(InternalName)
278-
if ##class(Utils).IsInSourceControl(InternalName) {
278+
if ##class(Utils).IsInSourceControl(InternalName) && ##class(%File).Exists(Filename) {
279279
quit ##class(Change).AddDeletedToUncommitted(Filename, InternalName)
280280
}
281281
quit $$$OK

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ Method OnPull() As %Status
1414

1515
for i=1:1:$get(..ModifiedFiles){
1616
set internalName = ..ModifiedFiles(i).internalName
17-
if ((internalName = "") && (..ModifiedFiles(i).changeType '= "D")) {
17+
if (((internalName = "") && (..ModifiedFiles(i).changeType '= "D")) || (..ModifiedFiles(i).changeType = "D")) {
1818
write !, ..ModifiedFiles(i).externalName, " was not imported into the database and will not be compiled. "
1919
} else {
2020
set compilelist(internalName) = ""
2121
set nFiles = nFiles + 1
2222
set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
23+
$$$ThrowOnError(loadSC)
2324
}
2425
}
2526

cls/SourceControl/Git/TestDelete.cls

Lines changed: 0 additions & 4 deletions
This file was deleted.

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ ClassMethod Pull(remote As %String = "origin", preview As %Boolean = 0) As %Stat
355355
write !, "Fetch done"
356356
write !, "Files that will be modified by git pull: "
357357

358-
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errStream,.outStream, (branchName_"..."_(remote_"/"_branchName)), "--name-status")
358+
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errStream,.outStream, remote_"/"_branchName, "--name-status")
359359
while (outStream.AtEnd = 0) {
360360
set file = outStream.ReadLine()
361361
set modification = ##class(SourceControl.Git.Modification).%New()

0 commit comments

Comments
 (0)