Skip to content

Commit c48307e

Browse files
committed
feat: FullLoad pull event handler that does full import
1 parent ebf34b1 commit c48307e

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111
- Production Decomposition mode allows controlling interoperability productions as individual files for each host (#469)
12+
- FullLoad pull event handler allows deploying changes with a full import of the repository (#619)
1213

1314
## [2.7.1] - Unreleased
1415

cls/SourceControl/Git/PullEventHandler.cls

+8-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ Method OnPull() As %Status [ Abstract ]
2121
}
2222

2323
/// <var>files</var> is an integer-subscripted array of <class>SourceControl.Git.Modification</class> objects.
24-
ClassMethod ForModifications(ByRef files) As %Status
24+
/// <var>pullEventClass</var>: if defined, override the configured pull event class
25+
ClassMethod ForModifications(ByRef files, pullEventClass As %String) As %Status
2526
{
26-
set event = $classmethod(##class(SourceControl.Git.Utils).PullEventClass(),"%New")
27+
set event = $classmethod(
28+
$select(
29+
$data(pullEventClass)#2: pullEventClass,
30+
1: ##class(SourceControl.Git.Utils).PullEventClass())
31+
,"%New")
2732
set event.LocalRoot = ##class(SourceControl.Git.Utils).TempFolder()
2833
merge event.ModifiedFiles = files
2934
quit event.OnPull()
@@ -44,4 +49,4 @@ ClassMethod ForInternalNames(InternalName As %String) As %Status
4449
quit ..ForModifications(.files)
4550
}
4651

47-
}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Class SourceControl.Git.PullEventHandler.FullLoad Extends SourceControl.Git.PullEventHandler
2+
{
3+
4+
Parameter NAME = "Full Load";
5+
6+
Parameter DESCRIPTION = "Performs an full load and compile of all items in the repository.";
7+
8+
Method OnPull() As %Status
9+
{
10+
return ##class(SourceControl.Git.Utils).ImportAll(1,
11+
##class(SourceControl.Git.PullEventHandler.IncrementalLoad).%ClassName(1))
12+
}
13+
14+
}

cls/SourceControl/Git/Utils.cls

+5-4
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
15361536
quit $$$OK
15371537
}
15381538

1539-
ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
1539+
ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As %Status
15401540
{
15411541
set refContext = ##class(SourceControl.Git.PackageManagerContext).%Get()
15421542
set refPackage = refContext.Package
@@ -1600,7 +1600,7 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
16001600
}
16011601
}
16021602

1603-
set sc = ##class(SourceControl.Git.PullEventHandler).ForModifications(.files)
1603+
set sc = ##class(SourceControl.Git.PullEventHandler).ForModifications(.files, .pullEventClass)
16041604
if $$$ISERR(sc) {
16051605
set ec = $$$ADDSC(ec,sc)
16061606
}
@@ -1733,9 +1733,10 @@ ClassMethod ExportSystemDefaults() As %Status
17331733
}
17341734

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

17411742
ClassMethod ExportRoutines(force As %Boolean = 0) As %Status

0 commit comments

Comments
 (0)