Skip to content

Commit 3f6851e

Browse files
authored
Merge branch 'main' into fix-decomp-bad-cache
2 parents 96a1306 + b29baf0 commit 3f6851e

File tree

6 files changed

+87
-13
lines changed

6 files changed

+87
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- LoadProductionsFromDirectory method to help custom deployment scripts load decomposed productions from the repository (#670)
1212
- Added ability to reset head / revert most recent commit (#586)
13+
- Changes deployed through Git are now logged in a new table SourceControl_Git.DeploymentLog
1314

1415
### Fixed
1516
- Fixed not showing warnings on Studio (#660)
1617
- Fixed business processes and rules not being added to source control automatically (#676)
1718
- Embedded Git commits settings when cloning empty repo to avert any issues
1819
- Fixed Import All options not importing the Embedded Git configuration file
20+
- That configuration file now imports before everything else (#697)
1921
- Improved performance of IDE editing and baselining of decomposed productions
2022
- Fixed Discard / Stash not working on deletes (#688)
23+
- Fixed errors deploying decomposed production changes on Windows network drives (#696)
24+
- Improved performance of deploying changes to decomposed production items (#690)
2125
- Fixed errors saving decomposed productions when invalid items in item cache (#701)
2226
- Removed unnecessary Add and Remove menu items from decomposed productions (#701)
2327

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Class SourceControl.Git.DeploymentLog Extends %Persistent [ Owner = {%Developer} ]
2+
{
3+
4+
Property Token As %String [ InitialExpression = {$System.Util.CreateGUID()} ];
5+
6+
Property StartTimestamp As %TimeStamp;
7+
8+
Property EndTimestamp As %TimeStamp;
9+
10+
Property HeadRevision As %String;
11+
12+
Property Status As %Status;
13+
14+
Storage Default
15+
{
16+
<Data name="DeploymentLogDefaultData">
17+
<Value name="1">
18+
<Value>%%CLASSNAME</Value>
19+
</Value>
20+
<Value name="2">
21+
<Value>Token</Value>
22+
</Value>
23+
<Value name="3">
24+
<Value>StartTimestamp</Value>
25+
</Value>
26+
<Value name="4">
27+
<Value>EndTimestamp</Value>
28+
</Value>
29+
<Value name="5">
30+
<Value>HeadRevision</Value>
31+
</Value>
32+
<Value name="6">
33+
<Value>Status</Value>
34+
</Value>
35+
</Data>
36+
<DataLocation>^SourceContro22B9.DeploymentLogD</DataLocation>
37+
<DefaultData>DeploymentLogDefaultData</DefaultData>
38+
<IdLocation>^SourceContro22B9.DeploymentLogD</IdLocation>
39+
<IndexLocation>^SourceContro22B9.DeploymentLogI</IndexLocation>
40+
<StreamLocation>^SourceContro22B9.DeploymentLogS</StreamLocation>
41+
<Type>%Storage.Persistent</Type>
42+
}
43+
44+
}

cls/SourceControl/Git/Production.cls

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,12 @@ ClassMethod ParseExternalName(externalName, Output internalName = "", Output pro
380380
} else {
381381
if ##class(%File).Exists(externalName) {
382382
// Special case for Config Item Settings PTD, requires checking PTD CDATA for Item and Class name
383-
set deployDoc = ##class(EnsLib.EDI.XML.Document).%New(externalName)
383+
// XML parser requires \\ instead of // for network directories
384+
set deployDoc = ##class(EnsLib.EDI.XML.Document).%New($replace(externalName,"//","\\"))
385+
if '$isobject(deployDoc) {
386+
set sc = $$$ADDSC(%objlasterror,$$$ERROR($$$GeneralError,"Failed to create document"))
387+
quit
388+
}
384389
set exportNotesPTDText = $ZCVT(deployDoc.GetValueAt("/Export/Document[1]/1"),"I","XML")
385390
set exportNotesPTD = ##class(EnsLib.EDI.XML.Document).%New(exportNotesPTDText)
386391
set productionName = exportNotesPTD.GetValueAt("/Deployment/Creation/SourceProduction")

cls/SourceControl/Git/PullEventHandler.cls

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,29 @@ Method OnPull() As %Status [ Abstract ]
2424
/// <var>pullEventClass</var>: if defined, override the configured pull event class
2525
ClassMethod ForModifications(ByRef files, pullEventClass As %String) As %Status
2626
{
27-
set event = $classmethod(
28-
$select(
29-
$data(pullEventClass)#2: pullEventClass,
30-
1: ##class(SourceControl.Git.Utils).PullEventClass())
31-
,"%New")
32-
set event.LocalRoot = ##class(SourceControl.Git.Utils).TempFolder()
33-
merge event.ModifiedFiles = files
34-
quit event.OnPull()
27+
set st = $$$OK
28+
try {
29+
set log = ##class(SourceControl.Git.DeploymentLog).%New()
30+
set log.HeadRevision = ##class(SourceControl.Git.Utils).GetCurrentRevision()
31+
set log.StartTimestamp = $zdatetime($ztimestamp,3)
32+
set st = log.%Save()
33+
quit:$$$ISERR(st)
34+
set event = $classmethod(
35+
$select(
36+
$data(pullEventClass)#2: pullEventClass,
37+
1: ##class(SourceControl.Git.Utils).PullEventClass())
38+
,"%New")
39+
set event.LocalRoot = ##class(SourceControl.Git.Utils).TempFolder()
40+
merge event.ModifiedFiles = files
41+
set st = event.OnPull()
42+
set log.EndTimestamp = $zdatetime($ztimestamp,3)
43+
set log.Status = st
44+
set st = log.%Save()
45+
quit:$$$ISERR(st)
46+
} catch err {
47+
set st = err.AsStatus()
48+
}
49+
quit st
3550
}
3651

3752
/// <var>InternalName</var> may be a comma-delimited string or $ListBuild list

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ Parameter DESCRIPTION = "Performs an incremental load and compile of all changes
1010
Method OnPull() As %Status
1111
{
1212
set sc = $$$OK
13+
14+
// certain items must be imported before everything else.
15+
for i=1:1:$get(..ModifiedFiles) {
16+
set internalName = ..ModifiedFiles(i).internalName
17+
if internalName = ##class(SourceControl.Git.Settings.Document).#INTERNALNAME {
18+
set sc = $$$ADDSC(sc, ##class(SourceControl.Git.Utils).ImportItem(internalName))
19+
}
20+
}
21+
1322
set nFiles = 0
1423

1524
for i=1:1:$get(..ModifiedFiles){

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ ClassMethod Exists(ByRef pFilename) As %Boolean
754754
Return 0
755755
}
756756

757+
/// Adds this item to the list of items that are tracked by source control
757758
ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
758759
{
759760
#dim i as %Integer
@@ -764,10 +765,6 @@ ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
764765
continue
765766
}
766767
set @..#Storage@("items", item) = ""
767-
#dim sc as %Status = ..ImportItem(item, 1)
768-
if 'sc {
769-
set ec = $$$ADDSC(ec, sc)
770-
}
771768
}
772769
quit ec
773770
}

0 commit comments

Comments
 (0)