diff --git a/CHANGELOG.md b/CHANGELOG.md index 3550acfa..3154b6eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Performance improvements (#269, #315) - Checkout of branches whose names contain slashes via Web UI no longer fails (#295) - Display other developer's username in Web UI's Workspace when hovering over the name of a file they changed (#304) +- Incremental load PullEventHandler now handles file deletion (#299) +- Incremental load PullEventHandler no longer returns a Success Status if an error was thrown during the pull process (#300) +- CSP applications can now be added to Git successfully (#308) ## [2.3.0] - 2023-12-06 diff --git a/cls/SourceControl/Git/Extension.cls b/cls/SourceControl/Git/Extension.cls index 96785da2..3f34fb79 100644 --- a/cls/SourceControl/Git/Extension.cls +++ b/cls/SourceControl/Git/Extension.cls @@ -275,7 +275,7 @@ Method OnBeforeDelete(InternalName As %String) As %Status set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName) set InternalName = ##class(Utils).NormalizeInternalName(InternalName) set Filename = ##class(Utils).FullExternalName(InternalName) - if ##class(Utils).IsInSourceControl(InternalName) { + if ##class(Utils).IsInSourceControl(InternalName) && ##class(%File).Exists(Filename) { quit ##class(Change).AddDeletedToUncommitted(Filename, InternalName) } quit $$$OK diff --git a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls index f6a51896..de052822 100644 --- a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls +++ b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls @@ -16,10 +16,18 @@ Method OnPull() As %Status set internalName = ..ModifiedFiles(i).internalName if ((internalName = "") && (..ModifiedFiles(i).changeType '= "D")) { write !, ..ModifiedFiles(i).externalName, " was not imported into the database and will not be compiled. " + } elseif (..ModifiedFiles(i).changeType = "D") { + set sc = ..DeleteFile(internalName) + if sc { + write !, ..ModifiedFiles(i).externalName, " was deleted." + } else { + write !, "WARNING: Deletion of ", ..ModifiedFiles(i).externalName, " failed." + } } else { set compilelist(internalName) = "" set nFiles = nFiles + 1 set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1)) + $$$ThrowOnError(loadSC) } } @@ -30,5 +38,16 @@ Method OnPull() As %Status quit $system.OBJ.CompileList(.compilelist, "cukb") } +Method DeleteFile(item As %String) +{ + set type = ##class(SourceControl.Git.Utils).Type(item) + if (type = "cls") { + quit $System.OBJ.Delete(item) + } elseif (type = "csp") { + quit $System.CSP.DeletePage(item) + } else { + quit ##class(%Library.RoutineMgr).Delete(item) + } } +} diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index f41960cc..ce66781d 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -355,7 +355,7 @@ ClassMethod Pull(remote As %String = "origin", preview As %Boolean = 0) As %Stat write !, "Fetch done" write !, "Files that will be modified by git pull: " - do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errStream,.outStream, (branchName_"..."_(remote_"/"_branchName)), "--name-status") + do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("diff",,.errStream,.outStream, remote_"/"_branchName, "--name-status") while (outStream.AtEnd = 0) { set file = outStream.ReadLine() set modification = ##class(SourceControl.Git.Modification).%New() @@ -985,7 +985,7 @@ ClassMethod NormalizeInternalName(ByRef name As %String) As %String set type = ..Type(.name) - if $extract(name) '= "/" { + if ($extract(name) '= "/") && (type'="csp") { quit $piece(name,".",1,*-1)_"."_$zconvert($piece(name,".",*),"U") }