Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.15.1] - Unreleased
## [2.16.0] - Unreleased

### Added
- Baseline Export now includes decomposed production items when production decomposition is enabled (#680)

## Fixed
- Fixed issue where Generated Files Read-only option didn't entirely work for files not in source control (#712)
Expand Down
1 change: 0 additions & 1 deletion cls/SourceControl/Git/Util/Production.cls
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ClassMethod BaselineProduction(productionName, settings As SourceControl.Git.Set
/// Baselines all productions in this namespace from single-file to decomposed or vice versa.
ClassMethod BaselineProductions()
{
set st = $$$OK
set settings = ##class(SourceControl.Git.Settings).%New()
set rs = ##class(%Dictionary.ClassDefinition).SubclassOfFunc("Ens.Production")
throw:rs.%SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(rs.%SQLCODE,rs.%Message)
Expand Down
4 changes: 4 additions & 0 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3115,6 +3115,7 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
{
set sc = $$$OK
try {
set settings = ##class(SourceControl.Git.Settings).%New()
write !, "Exporting items..."
set rs = ##class(%Library.RoutineMgr).StudioOpenDialogFunc(
"*.mac,*.int,*.inc,*.cls,*.csp,*.xsl,*.HL7,*.LUT,*.AST,*.X12"
Expand All @@ -3134,6 +3135,9 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
continue:($isobject(context.Package) && 'context.IsInDefaultPackage)
$$$ThrowOnError(..AddToSourceControl(internalName))
}
if settings.decomposeProductions && ##class(%Library.EnsembleMgr).IsEnsembleNamespace() {
do ##class(SourceControl.Git.Util.Production).BaselineProductions()
}
if pCommitMessage '= "" {
// switch to default context
do ##class(SourceControl.Git.PackageManagerContext).ForInternalName("")
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Document name="git-source-control.ZPM">
<Module>
<Name>git-source-control</Name>
<Version>2.15.1</Version>
<Version>2.16.0</Version>
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
<Keywords>git source control studio vscode</Keywords>
<Packaging>module</Packaging>
Expand Down
48 changes: 48 additions & 0 deletions test/UnitTest/SourceControl/Git/BaselineExport.cls
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Class UnitTest.SourceControl.Git.BaselineExport Extends %UnitTest.TestCase
{

Parameter ProductionName = "UnitTest.BaselineExportProduction";

Method TestBaselineExport()
{
// create a mac routine
Expand Down Expand Up @@ -33,10 +35,45 @@ Method TestBaselineExport()
do $$$AssertTrue(##class(SourceControl.Git.Utils).IsInSourceControl("TestPkg.Class.cls"))
}

Method TestBaselineExportWithDecomposedProduction()
{
do $System.OBJ.Delete(..#ProductionName)
set settings = ##class(SourceControl.Git.Settings).%New()
set settings.decomposeProductions = 1
$$$ThrowOnError(settings.%Save())
$$$ThrowOnError(##class(SourceControl.Git.Production).CreateProduction(..#ProductionName))
do ..ReplaceProductionDefinition()
do $$$AssertNotTrue(##class(SourceControl.Git.Utils).IsInSourceControl(..#ProductionName_".cls"))
do $$$AssertNotTrue(##class(SourceControl.Git.Utils).IsInSourceControl(..#ProductionName_"||ProductionSettings-"_..#ProductionName_".PTD"))
do $$$AssertNotTrue(##class(SourceControl.Git.Utils).IsInSourceControl(..#ProductionName_"||Settings-a|Ens.Activity.Operation.Local.PTD"))
do $$$AssertStatusOK(##class(SourceControl.Git.API).BaselineExport())
do $$$AssertTrue(##class(SourceControl.Git.Utils).IsInSourceControl(..#ProductionName_"||ProductionSettings-"_..#ProductionName_".PTD"))
do $$$AssertTrue(##class(SourceControl.Git.Utils).IsInSourceControl(..#ProductionName_"||Settings-a|Ens.Activity.Operation.Local.PTD"))
}

Property InitialExtension As %String [ InitialExpression = {##class(%Studio.SourceControl.Interface).SourceControlClassGet()} ];

Property SourceControlGlobal [ MultiDimensional ];

ClassMethod ReplaceProductionDefinition()
{
set productionClass = ##class(%Dictionary.ClassDefinition).%OpenId(..#ProductionName)
do productionClass.XDatas.Clear()
set productionXData = ##class(%Dictionary.XDataDefinition).%New()
set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen($classname(),"ProductionDefinition",,.st)
$$$ThrowOnError(st)
set productionXData = xdata.%ConstructClone(1)
set productionXData.Name = "ProductionDefinition"
set st = productionClass.XDatas.Insert(productionXData)
$$$ThrowOnError(st)
set st = productionClass.%Save()
$$$ThrowOnError(st)
set st = $System.OBJ.Compile(..#ProductionName)
$$$ThrowOnError(st)
set st = ##class(Ens.Production).Update()
$$$ThrowOnError(st)
}

Method %OnNew(initvalue) As %Status
{
Merge ..SourceControlGlobal = ^SYS("SourceControl")
Expand All @@ -45,6 +82,7 @@ Method %OnNew(initvalue) As %Status
Set settings.namespaceTemp = ##class(%Library.File).TempFilename()_"dir"
Set settings.Mappings("MAC","*")="rtn/"
Set settings.Mappings("CLS","*")="cls/"
Set settings.Mappings("PTD","*")="ptd/"
Do settings.%Save()
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension")
Quit ##super(initvalue)
Expand All @@ -55,7 +93,17 @@ Method %OnClose() As %Status [ Private, ServerOnly = 1 ]
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet(..InitialExtension)
Kill ^SYS("SourceControl")
Merge ^SYS("SourceControl") = ..SourceControlGlobal
Do $System.OBJ.Delete(..#ProductionName)
Quit $$$OK
}

XData ProductionDefinition
{
<Production Name="UnitTest.BaselineExportProduction" LogGeneralTraceEvents="false">
<Item Name="a" Category="" ClassName="Ens.Activity.Operation.Local" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
<Setting Target="Host" Name="RecordStatsInterval">61</Setting>
</Item>
</Production>
}

}
Loading