Skip to content

Commit

Permalink
feat: FullLoad pull event handler that does full import
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-pbarton committed Nov 19, 2024
1 parent fe4b89d commit 09c839a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Production Decomposition mode allows controlling interoperability productions as individual files for each host (#469)
- Added saving settings as system default for new namespaces (#535)
- Added filtering through branch names in UI (#615)
- FullLoad pull event handler allows deploying changes with a full import of the repository (#619)

## [2.7.1] - 2024-11-13

Expand Down
11 changes: 8 additions & 3 deletions cls/SourceControl/Git/PullEventHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ Method OnPull() As %Status [ Abstract ]
}

/// <var>files</var> is an integer-subscripted array of <class>SourceControl.Git.Modification</class> objects.
ClassMethod ForModifications(ByRef files) As %Status
/// <var>pullEventClass</var>: if defined, override the configured pull event class
ClassMethod ForModifications(ByRef files, pullEventClass As %String) As %Status
{
set event = $classmethod(##class(SourceControl.Git.Utils).PullEventClass(),"%New")
set event = $classmethod(
$select(
$data(pullEventClass)#2: pullEventClass,
1: ##class(SourceControl.Git.Utils).PullEventClass())
,"%New")
set event.LocalRoot = ##class(SourceControl.Git.Utils).TempFolder()
merge event.ModifiedFiles = files
quit event.OnPull()
Expand All @@ -44,4 +49,4 @@ ClassMethod ForInternalNames(InternalName As %String) As %Status
quit ..ForModifications(.files)
}

}
}
14 changes: 14 additions & 0 deletions cls/SourceControl/Git/PullEventHandler/FullLoad.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Class SourceControl.Git.PullEventHandler.FullLoad Extends SourceControl.Git.PullEventHandler
{

Parameter NAME = "Full Load";

Parameter DESCRIPTION = "Performs an full load and compile of all items in the repository.";

Method OnPull() As %Status
{
return ##class(SourceControl.Git.Utils).ImportAll(1,
##class(SourceControl.Git.PullEventHandler.IncrementalLoad).%ClassName(1))
}

}
9 changes: 5 additions & 4 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
quit $$$OK
}

ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As %Status
{
set refContext = ##class(SourceControl.Git.PackageManagerContext).%Get()
set refPackage = refContext.Package
Expand Down Expand Up @@ -1600,7 +1600,7 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
}
}

set sc = ##class(SourceControl.Git.PullEventHandler).ForModifications(.files)
set sc = ##class(SourceControl.Git.PullEventHandler).ForModifications(.files, .pullEventClass)
if $$$ISERR(sc) {
set ec = $$$ADDSC(ec,sc)
}
Expand Down Expand Up @@ -1733,9 +1733,10 @@ ClassMethod ExportSystemDefaults() As %Status
}

/// if <var>force</var> = 1 then we import item even if timestamp in system is newer
ClassMethod ImportAll(force As %Boolean = 0) As %Status
/// if <var>pullEventClass</var> is defined, then override the configured pull event handler class.
ClassMethod ImportAll(force As %Boolean = 0, pullEventClass As %String) As %Status
{
quit ..ImportRoutines(force)
quit ..ImportRoutines(force, .pullEventClass)
}

ClassMethod ExportRoutines(force As %Boolean = 0) As %Status
Expand Down

0 comments on commit 09c839a

Please sign in to comment.