Skip to content

Commit 6f7e883

Browse files
committed
By default, be package manager-aware if possible and do an incremental load if not
1 parent 9b4ad6e commit 6f7e883

File tree

2 files changed

+41
-22
lines changed

2 files changed

+41
-22
lines changed

cls/SourceControl/Git/PullEventHandler/Default.cls

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
11
Include SourceControl.Git
22

3-
Class SourceControl.Git.PullEventHandler.Default Extends SourceControl.Git.PullEventHandler
3+
Class SourceControl.Git.PullEventHandler.Default Extends (SourceControl.Git.PullEventHandler.IncrementalLoad,SourceControl.Git.PullEventHandler.PackageManager)
44
{
55

66
Parameter NAME = "Default";
77

8-
Parameter DESCRIPTION = "Performs an incremental load and compile of all changes pulled.";
8+
Parameter DESCRIPTION = "Does a zpm ""load <repo root>"" for PackageManager-enabled repos and an incremental load otherwise.";
99

1010
Method OnPull() As %Status
1111
{
12-
set loadSC = $$$OK
13-
set nFiles = 0
14-
for i=1:1:$Get(..ModifiedFiles) {
15-
if $Data(files(i))#2 {
16-
set internalName = ##class(SourceControl.Git.Utils).NameToInternalName(..ModifiedFiles(i))
17-
if (internalName = "") {
18-
write files(i), " was not imported into the database and will not be compiled. ", !
19-
} else {
20-
set compilelist(internalName) = ""
21-
set nFiles = nFiles + 1
22-
set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
23-
}
24-
}
12+
If ##class(%Library.File).Exists(##class(%Library.File).NormalizeFilename("module.xml",..LocalRoot)) {
13+
Quit ##class(SourceControl.Git.PullEventHandler.PackageManager)$This.OnPull()
2514
}
26-
27-
if (nFiles = 0) {
28-
write "Nothing to compile.",!
29-
quit $$$OK
30-
}
31-
32-
Quit $System.OBJ.CompileList(.compilelist, "cukb")
15+
Quit ##class(SourceControl.Git.PullEventHandler.IncrementalLoad)$This.OnPull()
3316
}
3417

3518
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Include SourceControl.Git
2+
3+
Class SourceControl.Git.PullEventHandler.Default Extends SourceControl.Git.PullEventHandler
4+
{
5+
6+
Parameter NAME = "Incremental Load";
7+
8+
Parameter DESCRIPTION = "Performs an incremental load and compile of all changes pulled.";
9+
10+
Method OnPull() As %Status
11+
{
12+
set loadSC = $$$OK
13+
set nFiles = 0
14+
for i=1:1:$Get(..ModifiedFiles) {
15+
if $Data(files(i))#2 {
16+
set internalName = ##class(SourceControl.Git.Utils).NameToInternalName(..ModifiedFiles(i))
17+
if (internalName = "") {
18+
write files(i), " was not imported into the database and will not be compiled. ", !
19+
} else {
20+
set compilelist(internalName) = ""
21+
set nFiles = nFiles + 1
22+
set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
23+
}
24+
}
25+
}
26+
27+
if (nFiles = 0) {
28+
write "Nothing to compile.",!
29+
quit $$$OK
30+
}
31+
32+
Quit $System.OBJ.CompileList(.compilelist, "cukb")
33+
}
34+
35+
}
36+

0 commit comments

Comments
 (0)