Skip to content

Commit

Permalink
Merge branch 'main' into fix-decomp-bad-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-tleavitt authored Jan 31, 2025
2 parents 96a1306 + b29baf0 commit 3f6851e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- LoadProductionsFromDirectory method to help custom deployment scripts load decomposed productions from the repository (#670)
- Added ability to reset head / revert most recent commit (#586)
- Changes deployed through Git are now logged in a new table SourceControl_Git.DeploymentLog

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

Expand Down
44 changes: 44 additions & 0 deletions cls/SourceControl/Git/DeploymentLog.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Class SourceControl.Git.DeploymentLog Extends %Persistent [ Owner = {%Developer} ]
{

Property Token As %String [ InitialExpression = {$System.Util.CreateGUID()} ];

Property StartTimestamp As %TimeStamp;

Property EndTimestamp As %TimeStamp;

Property HeadRevision As %String;

Property Status As %Status;

Storage Default
{
<Data name="DeploymentLogDefaultData">
<Value name="1">
<Value>%%CLASSNAME</Value>
</Value>
<Value name="2">
<Value>Token</Value>
</Value>
<Value name="3">
<Value>StartTimestamp</Value>
</Value>
<Value name="4">
<Value>EndTimestamp</Value>
</Value>
<Value name="5">
<Value>HeadRevision</Value>
</Value>
<Value name="6">
<Value>Status</Value>
</Value>
</Data>
<DataLocation>^SourceContro22B9.DeploymentLogD</DataLocation>
<DefaultData>DeploymentLogDefaultData</DefaultData>
<IdLocation>^SourceContro22B9.DeploymentLogD</IdLocation>
<IndexLocation>^SourceContro22B9.DeploymentLogI</IndexLocation>
<StreamLocation>^SourceContro22B9.DeploymentLogS</StreamLocation>
<Type>%Storage.Persistent</Type>
}

}
7 changes: 6 additions & 1 deletion cls/SourceControl/Git/Production.cls
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,12 @@ ClassMethod ParseExternalName(externalName, Output internalName = "", Output pro
} else {
if ##class(%File).Exists(externalName) {
// Special case for Config Item Settings PTD, requires checking PTD CDATA for Item and Class name
set deployDoc = ##class(EnsLib.EDI.XML.Document).%New(externalName)
// XML parser requires \\ instead of // for network directories
set deployDoc = ##class(EnsLib.EDI.XML.Document).%New($replace(externalName,"//","\\"))
if '$isobject(deployDoc) {
set sc = $$$ADDSC(%objlasterror,$$$ERROR($$$GeneralError,"Failed to create document"))
quit
}
set exportNotesPTDText = $ZCVT(deployDoc.GetValueAt("/Export/Document[1]/1"),"I","XML")
set exportNotesPTD = ##class(EnsLib.EDI.XML.Document).%New(exportNotesPTDText)
set productionName = exportNotesPTD.GetValueAt("/Deployment/Creation/SourceProduction")
Expand Down
31 changes: 23 additions & 8 deletions cls/SourceControl/Git/PullEventHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,29 @@ Method OnPull() As %Status [ Abstract ]
/// <var>pullEventClass</var>: if defined, override the configured pull event class
ClassMethod ForModifications(ByRef files, pullEventClass As %String) As %Status
{
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()
set st = $$$OK
try {
set log = ##class(SourceControl.Git.DeploymentLog).%New()
set log.HeadRevision = ##class(SourceControl.Git.Utils).GetCurrentRevision()
set log.StartTimestamp = $zdatetime($ztimestamp,3)
set st = log.%Save()
quit:$$$ISERR(st)
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
set st = event.OnPull()
set log.EndTimestamp = $zdatetime($ztimestamp,3)
set log.Status = st
set st = log.%Save()
quit:$$$ISERR(st)
} catch err {
set st = err.AsStatus()
}
quit st
}

/// <var>InternalName</var> may be a comma-delimited string or $ListBuild list
Expand Down
9 changes: 9 additions & 0 deletions cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ Parameter DESCRIPTION = "Performs an incremental load and compile of all changes
Method OnPull() As %Status
{
set sc = $$$OK

// certain items must be imported before everything else.
for i=1:1:$get(..ModifiedFiles) {
set internalName = ..ModifiedFiles(i).internalName
if internalName = ##class(SourceControl.Git.Settings.Document).#INTERNALNAME {
set sc = $$$ADDSC(sc, ##class(SourceControl.Git.Utils).ImportItem(internalName))
}
}

set nFiles = 0

for i=1:1:$get(..ModifiedFiles){
Expand Down
5 changes: 1 addition & 4 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ ClassMethod Exists(ByRef pFilename) As %Boolean
Return 0
}

/// Adds this item to the list of items that are tracked by source control
ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
{
#dim i as %Integer
Expand All @@ -764,10 +765,6 @@ ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
continue
}
set @..#Storage@("items", item) = ""
#dim sc as %Status = ..ImportItem(item, 1)
if 'sc {
set ec = $$$ADDSC(ec, sc)
}
}
quit ec
}
Expand Down

0 comments on commit 3f6851e

Please sign in to comment.