Skip to content

Commit b0560f6

Browse files
authored
Merge pull request #212 from intersystems/pre-iris-installer
Support pre-IRIS installation
2 parents 776336d + 8e6a6c6 commit b0560f6

File tree

5 files changed

+156
-8
lines changed

5 files changed

+156
-8
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.6] - 2022-12-06
9+
10+
### Added
11+
- Support for Caché/Ensemble 2016.2.3, 2017.1.2, 2017.2.1, 2018.1.0 and later. (Treated as patch version bump because no compatibility impact for existing users.)
12+
13+
### Changed
14+
- Various minor things under the hood to support use without the package manager and/or on older platforms
15+
816
## [2.0.5] - 2022-12-02
917

1018
### Fixed

cls/SourceControl/Git/Change.cls

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

3-
Class SourceControl.Git.Change Extends %Studio.SourceControl.Change
3+
Class SourceControl.Git.Change Extends (%Persistent, %Studio.SourceControl.Change)
44
{
55

66
/// Returns the name of the backup file for this Item in the file system
@@ -10,10 +10,9 @@ Property BackupName As %String [ Calculated, SqlComputeCode = {s {*} = ""}, SqlC
1010
/// Returns the name of this Item in the file system
1111
Property ExternalName As %String [ Calculated, SqlComputeCode = {S {*} = "" }, SqlComputed ];
1212

13-
Storage Default
14-
{
15-
<Type>%Storage.Persistent</Type>
16-
}
13+
Index CommittedMap On Committed [ Type = bitmap ];
14+
15+
Index ChangeList On (ItemFile, CommittedTime) [ Data = Action, Unique ];
1716

1817
/// Removes one or more Uncommitted items from the Uncommitted queue and changes the exported file to Readonly (except for reverts of Adds, or new CSP files within the Perforce root)
1918
/// <P> Default assumed behavior is that the the change was not reverted, and that it was actively committed to Perforce
@@ -128,5 +127,56 @@ ClassMethod RefreshUncommitted(Display = 0, IncludeRevert = 0, Output gitFiles)
128127
quit sc
129128
}
130129

130+
Storage Default
131+
{
132+
<Data name="ChangeDefaultData">
133+
<Value name="1">
134+
<Value>%%CLASSNAME</Value>
135+
</Value>
136+
<Value name="2">
137+
<Value>Action</Value>
138+
</Value>
139+
<Value name="3">
140+
<Value>Committed</Value>
141+
</Value>
142+
<Value name="4">
143+
<Value>CommittedTime</Value>
144+
</Value>
145+
<Value name="5">
146+
<Value>CCR</Value>
147+
</Value>
148+
<Value name="6">
149+
<Value>InternalName</Value>
150+
</Value>
151+
<Value name="7">
152+
<Value>ItemFile</Value>
153+
</Value>
154+
<Value name="8">
155+
<Value>Name</Value>
156+
</Value>
157+
<Value name="10">
158+
<Value>Source</Value>
159+
</Value>
160+
<Value name="11">
161+
<Value>UpdatedTime</Value>
162+
</Value>
163+
<Value name="12">
164+
<Value>ChangedBy</Value>
165+
</Value>
166+
<Value name="13">
167+
<Value>ActivelyCommitted</Value>
168+
</Value>
169+
<Value name="14">
170+
<Value>P4Issued</Value>
171+
</Value>
172+
</Data>
173+
<DataLocation>^Studio.SourceControl.ChangeD</DataLocation>
174+
<DefaultData>ChangeDefaultData</DefaultData>
175+
<IdLocation>^Studio.SourceControl.ChangeD</IdLocation>
176+
<IndexLocation>^Studio.SourceControl.ChangeI</IndexLocation>
177+
<StreamLocation>^Studio.SourceControl.ChangeS</StreamLocation>
178+
<Type>%Storage.Persistent</Type>
179+
}
180+
131181
}
132182

cls/SourceControl/Git/PackageManagerContext.cls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ Property IsInDefaultPackage As %Boolean [ InitialExpression = 0 ];
77

88
Property IsInGitEnabledPackage As %Boolean [ InitialExpression = 0 ];
99

10-
Property Package As %ZPM.PackageManager.Developer.Module [ InitialExpression = {$$$NULLOREF} ];
10+
/// Really is a %ZPM.PackageManager.Developer.Module
11+
Property Package As %RegisteredObject [ InitialExpression = {$$$NULLOREF} ];
1112

12-
Property ResourceReference As %ZPM.PackageManager.Developer.ResourceReference [ InitialExpression = {$$$NULLOREF} ];
13+
// Really is a %ZPM.PackageManager.Developer.ResourceReference
14+
15+
Property ResourceReference As %RegisteredObject [ InitialExpression = {$$$NULLOREF} ];
1316

1417
Method InternalNameSet(InternalName As %String = "") As %Status
1518
{
1619
if (InternalName '= i%InternalName) {
1720
set i%InternalName = InternalName
21+
if '$$$comClassDefined("%ZPM.PackageManager.Developer.Extension.Utils") {
22+
quit $$$OK
23+
}
1824
set ..Package = ##class(%ZPM.PackageManager.Developer.Extension.Utils).FindHomeModule(InternalName,,.resourceReference)
1925
set ..ResourceReference = resourceReference
2026
set ..IsInGitEnabledPackage = $isobject(..Package) && ##class(%Library.File).DirectoryExists(##class(%Library.File).NormalizeFilename(".git",..Package.Root))

cls/SourceControl/Git/Utils.cls

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,5 +1725,89 @@ ClassMethod GetSourceControlInclude() As %String
17251725
1: "")
17261726
}
17271727

1728+
ClassMethod BuildCEInstallationPackage(ByRef destination As %String) As %Status
1729+
{
1730+
#define sourcedir $System.Util.InstallDirectory()_"devuser/studio/templates/gitsourcecontrol/"
1731+
#define sourcedirstr ##Quote($$$sourcedir)
1732+
#define exportGBLString "||GitSourceControlProjectExport"
1733+
#define exportGBLDoc $$$exportGBLString_".GBL"
1734+
#define exportGBL ##Expression("^"_$$$exportGBLString)
1735+
#define exportGBLName $Name($$$exportGBL)
1736+
#define exportGBLNameQ ##Quote("^"_$$$exportGBLString)
1737+
1738+
new %sourcedirstr
1739+
set sc = $$$OK
1740+
try {
1741+
set projectName = "GitSourceControl_CE"
1742+
set exportSpec = "/keepsource/exportversion=2016.2/diffexport"
1743+
1744+
// Main project
1745+
set destination = $Get(destination,##class(%Library.File).NormalizeFilename(projectName_".xml"))
1746+
if ##class(%Studio.Project).%ExistsId(projectName) {
1747+
$$$ThrowOnError(##class(%Studio.Project).%DeleteId(projectName))
1748+
}
1749+
set project = ##class(%Studio.Project).%New()
1750+
set project.Name = projectName
1751+
$$$ThrowOnError($System.OBJ.GetPackageList(.classes,"SourceControl.Git"))
1752+
set key = ""
1753+
for {
1754+
set key = $Order(classes(key))
1755+
quit:key=""
1756+
$$$ThrowOnError(project.AddItem(key_".CLS"))
1757+
}
1758+
$$$ThrowOnError(project.AddItem("SourceControl.Git.INC"))
1759+
$$$ThrowOnError(project.AddItem("%ZPM.PackageManager.Core.Singleton.CLS"))
1760+
1761+
// /isc/studio/usertemplates project
1762+
set sourcedir = ##class(%Library.File).NormalizeDirectory($$$sourcedir)
1763+
set archive = ##class(%ZPM.PackageManager.Core.XDataArchive).%New(sourcedir)
1764+
do archive.AddToProject(project)
1765+
1766+
kill $$$exportGBL
1767+
$$$ThrowOnError(project.ExportToStream(exportSpec,0))
1768+
1769+
// Installer automation
1770+
set code($i(code)) = " New %ISCName set %ISCName = ""GitSourceControlInstaller"""
1771+
set code($i(code)) = " Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen(""SourceControl.Git.Installer"",""Payload"",,.sc)"
1772+
set code($i(code)) = " $$$ThrowOnError(sc)"
1773+
set code($i(code)) = " $$$ThrowOnError($System.OBJ.LoadStream(xdata.Data,""ck/nomulticompile""))"
1774+
do archive.GenerateInstallerCode($$$sourcedirstr,.code)
1775+
set code($i(code)) = " Do ##class(SourceControl.Git.Utils).Localize()"
1776+
set code($i(code)) = " Write !!"
1777+
set code($i(code)) = " Do ##class(SourceControl.Git.Utils).OutputConfigureMessage()"
1778+
1779+
// Put installer automation in class
1780+
do $System.OBJ.Delete("SourceControl.Git.Installer.CLS","-d")
1781+
set class = ##class(%Dictionary.ClassDefinition).%New()
1782+
set class.Name = "SourceControl.Git.Installer"
1783+
set class.IncludeGenerator = "%occInclude"
1784+
set method = ##class(%Dictionary.MethodDefinition).%New()
1785+
set method.Name = "Run"
1786+
set method.CodeMode = "objectgenerator"
1787+
for i=1:1:code {
1788+
do method.Implementation.WriteLine(code(i))
1789+
}
1790+
do method.Implementation.WriteLine(" job ##class(%SYSTEM.OBJ).Delete(""SourceControl.Git.Installer.CLS"")")
1791+
do class.Methods.Insert(method)
1792+
1793+
// Put payload in XData block
1794+
set xdata = ##class(%Dictionary.XDataDefinition).%New()
1795+
set xdata.Name = "Payload"
1796+
do xdata.Data.CopyFrom(project.Stream)
1797+
do class.XDatas.Insert(xdata)
1798+
1799+
$$$ThrowOnError(class.%Save())
1800+
1801+
$$$ThrowOnError($System.OBJ.Export(class.Name_".CLS,"_$$$exportGBLDoc,destination,exportSpec))
1802+
$$$ThrowOnError($System.OBJ.Delete("SourceControl.Git.Installer.CLS"))
1803+
} catch e {
1804+
set sc = e.AsStatus()
1805+
}
1806+
if $$$ISERR(sc) && '$quit {
1807+
write !,$System.Status.GetErrorText(sc)
1808+
}
1809+
quit sc
1810+
}
1811+
17281812
}
17291813

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Document name="git-source-control.ZPM">
44
<Module>
55
<Name>git-source-control</Name>
6-
<Version>2.0.5</Version>
6+
<Version>2.0.6</Version>
77
<Description>Server-side source control extension for use of Git on InterSystems platforms</Description>
88
<Keywords>git source control studio vscode</Keywords>
99
<Packaging>module</Packaging>

0 commit comments

Comments
 (0)