Skip to content

Commit aa05260

Browse files
committed
Merge branch 'main' into safeguard-discard
2 parents fb94fd1 + 2feb15c commit aa05260

File tree

20 files changed

+905
-108
lines changed

20 files changed

+905
-108
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
ls $GITHUB_WORKSPACE/$artifact_dir
8686
8787
- name: Attach CE Artifact
88-
uses: actions/upload-artifact@v3
88+
uses: actions/upload-artifact@v4
8989
if: always()
9090
with:
9191
name: "PreIRISInstallationPackage"
@@ -103,7 +103,7 @@ jobs:
103103
fail: false
104104

105105
- name: Attach the report
106-
uses: actions/upload-artifact@v1
106+
uses: actions/upload-artifact@v4
107107
if: always()
108108
with:
109109
name: ${{ steps.xunit-viewer.outputs.report-name }}

CHANGELOG.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,36 @@ 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.5.0] - Unreleased
8+
## [2.5.1] - Unreleased
99

1010
### Added
1111
- Discards safeguarded by discard stash and warning modal (#455)
1212

13+
### Fixed
14+
- Added warnings when user is using incompatible git version (#488)
15+
16+
## [2.5.0] - 2024-09-24
17+
18+
### Added
19+
- New UI for the basic mode Sync (#415)
20+
- Allow changing namespaces and IPM package context from web UI (#280)
21+
- Support for editing repo from filesystem perspective via web application (#464)
22+
- Support for downloading a VSCode workspace file from web UI
23+
- IncrementalLoad pull event handler will update the running production, if any (#473)
24+
25+
### Fixed
26+
- Instance wide settings are placed in proper global (#444)
27+
- Avoid delay/errors in loading interop JS when there is a URL prefix (e.g., instance name in multi-instance webserver configuration)
28+
- Added proper JS escaping in sync output
29+
- Added support to switch branch in basic mode from menu (#451)
30+
- Pull event handler will not fail when change set includes unmapped files (#453)
31+
- Pull event handler will attempt compile even if there are failures to load (#457)
32+
- Improved logging in preview and when errors occur via WebSocket commands (#467)
33+
- Fixed pull event handler handling of extremely long class names from diff (#467)
34+
- Fixed Git web UI prompt to update file list when file selected/unselected (#478)
35+
- Fixed folder settings in mappings to be saved and persist (#483)
36+
- Preview on the pull.csp page now shows commits from the correct branch (#490)
37+
1338
## [2.4.1] - 2024-08-02
1439

1540
### Added
@@ -158,4 +183,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158183

159184
## [2.0.1] - 2022-06-02
160185
- Last released version before CHANGELOG existed.
161-

cls/SourceControl/Git/API.cls

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ ClassMethod Configure()
1717
}
1818
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
1919
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)
20+
21+
// Make sure they are using an appropriate git version
22+
if (+$PIECE(version,"version ",2))<2.31 {
23+
write !!, "WARNING: You are using an older version of git which is not compatible with git-source-control. Please upgrade to git version 2.31.0 or greater to continue"
24+
write !!, "Cancelling git-source-control configuration..."
25+
quit
26+
}
2027
if gitExists && isDefault {
2128
// Note: version starts with "git version"
2229
write !,version," is available via PATH. You may enter a path to a different version if needed."
@@ -65,4 +72,3 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
6572
}
6673

6774
}
68-

cls/SourceControl/Git/Change.cls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,3 @@ Storage Default
238238
}
239239

240240
}
241-

cls/SourceControl/Git/Extension.cls

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ Method AfterUserAction(Type As %Integer, Name As %String, InternalName As %Strin
7474
if menu '= "%SourceMenu", menu'="%SourceContext" {
7575
quit $$$OK
7676
}
77-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName)
77+
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName, .fromWebApp)
7878
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
7979
set ec = ##class(SourceControl.Git.Utils).AfterUserAction(Type, Name, InternalName, .Answer, .Msg, .Reload)
80+
if fromWebApp {
81+
// Force reload and compile of actual item if underlying file has changed
82+
do ..OnBeforeLoad(InternalName,1,1)
83+
}
8084
quit ec
8185
}
8286

@@ -125,6 +129,7 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
125129
"Status": 1,
126130
"GitWebUI" : 1,
127131
"NewBranch": 1,
132+
"SwitchBranch": 1,
128133
"Sync": 1,
129134
"": 1,
130135
:-1
@@ -234,12 +239,12 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
234239

235240
/// This is called before the actual load of data to give the chance
236241
/// to load the item from an external format.
237-
Method OnBeforeLoad(InternalName As %String, verbose As %Boolean) As %Status
242+
Method OnBeforeLoad(InternalName As %String, verbose As %Boolean, compile As %Boolean = 0) As %Status
238243
{
239244
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
240245
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName)
241246
if ##class(SourceControl.Git.Utils).IsInSourceControl(InternalName) {
242-
quit ##class(SourceControl.Git.Utils).ImportItem(InternalName,,0)
247+
quit ##class(SourceControl.Git.Utils).ImportItem(InternalName,,0,compile)
243248
}
244249
quit $$$OK
245250
}
@@ -273,14 +278,21 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
273278
{
274279
set sc = $$$OK
275280
try {
276-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(.InternalName)
281+
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(.InternalName,.fromWebApp,.fullExternalName)
277282
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
278283
if ##class(SourceControl.Git.Utils).IsNamespaceInGit() && ..IsInSourceControl(InternalName) {
279-
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
280-
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
281-
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
282-
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
283-
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
284+
if fromWebApp {
285+
if fullExternalName = ##class(SourceControl.Git.Utils).FullExternalName(InternalName) {
286+
// Reimport item into database
287+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ImportItem(InternalName,,1,1))
288+
}
289+
} else {
290+
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
291+
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
292+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
293+
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
294+
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
295+
}
284296
}
285297
}
286298
} catch e {
@@ -403,4 +415,3 @@ Method AddToSourceControl(InternalName As %String, Description As %String = "")
403415
}
404416

405417
}
406-

cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,38 @@ Parameter DESCRIPTION = "Performs an incremental load and compile of all changes
99

1010
Method OnPull() As %Status
1111
{
12-
set loadSC = $$$OK
12+
set sc = $$$OK
1313
set nFiles = 0
1414

1515
for i=1:1:$get(..ModifiedFiles){
1616
set internalName = ..ModifiedFiles(i).internalName
1717
if ((internalName = "") && (..ModifiedFiles(i).changeType '= "D")) {
1818
write !, ..ModifiedFiles(i).externalName, " was not imported into the database and will not be compiled. "
1919
} elseif (..ModifiedFiles(i).changeType = "D") {
20-
set sc = ..DeleteFile(internalName)
21-
if sc {
20+
set delSC = ..DeleteFile(internalName)
21+
if delSC {
2222
write !, ..ModifiedFiles(i).externalName, " was deleted."
2323
} else {
2424
write !, "WARNING: Deletion of ", ..ModifiedFiles(i).externalName, " failed."
2525
}
2626
} else {
2727
set compilelist(internalName) = ""
2828
set nFiles = nFiles + 1
29-
set loadSC = $$$ADDSC(loadSC,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
30-
$$$ThrowOnError(loadSC)
29+
set sc = $$$ADDSC(sc,##class(SourceControl.Git.Utils).ImportItem(internalName, 1))
3130
}
3231
}
3332

3433
if (nFiles = 0) {
3534
write !, "Nothing to compile."
3635
quit $$$OK
3736
}
38-
quit $system.OBJ.CompileList(.compilelist, "ck")
37+
set sc = $$$ADDSC(sc,$system.OBJ.CompileList(.compilelist, "ck"))
38+
if $$$comClassDefined("Ens.Director") && ##class(Ens.Director).IsProductionRunning() {
39+
write !,"Updating production... "
40+
set sc = $$$ADDSC(sc,##class(Ens.Director).UpdateProduction())
41+
write "done."
42+
}
43+
quit sc
3944
}
4045

4146
Method DeleteFile(item As %String) As %Status
@@ -71,4 +76,3 @@ Method DeleteFile(item As %String) As %Status
7176
}
7277

7378
}
74-

cls/SourceControl/Git/Settings.cls

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Property defaultMergeBranch As %String [ InitialExpression = {##class(SourceCont
4747
/// Compile using the configured pull event handler when "Import All" is run
4848
Property compileOnImport As %Boolean [ InitialExpression = {##class(SourceControl.Git.Utils).CompileOnImport()} ];
4949

50+
/// Define a namespace-level web application allowing access to multiple git repos across separate namespaces
51+
Property namespaceLevelGitWebApp As %Boolean [ InitialExpression = {##class(SourceControl.Git.Settings).HasNamespaceWebApp()} ];
52+
5053
Property Mappings [ MultiDimensional ];
5154

5255
Method %OnNew() As %Status
@@ -160,6 +163,75 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
160163
do %code.WriteLine(" quit 1")
161164
}
162165

166+
Method ConfigureNamespaceWebApplication()
167+
{
168+
Set root = ##class(%Library.File).NormalizeDirectory(##class(SourceControl.Git.Utils).TempFolder())
169+
Set deleteWebApp = ..HasNamespaceWebApp(.appDirectory) && '..namespaceLevelGitWebApp
170+
Set createWebApp = ..namespaceLevelGitWebApp && '..HasNamespaceWebApp()
171+
Do ..WebAppOperation("/git/"_$Namespace_"/", createWebApp, deleteWebApp, root)
172+
}
173+
174+
Method WebAppOperation(name, create As %Boolean, delete As %Boolean, root As %String) [ Private ]
175+
{
176+
Set namespace = $Namespace
177+
New $Namespace
178+
Set $Namespace = "%SYS"
179+
If $Extract(name) = "/" {
180+
Set name = $Extract(name,1,*-1)
181+
}
182+
If delete {
183+
If ##class(Security.Applications).Exists(name) {
184+
$$$ThrowOnError(##class(Security.Applications).Delete(name))
185+
Write !,"Removed web application "_name
186+
}
187+
Quit
188+
}
189+
190+
// These are the only things we want to coerce.
191+
Set props("AutheEnabled")=0 // No auth methods enabled = impossible to use
192+
Set props("InbndWebServicesEnabled")=0
193+
Set props("ServeFiles")=0
194+
Set props("Enabled")=1
195+
Set props("Name")=name
196+
Set props("NameSpace")=namespace
197+
Set props("Path")=root
198+
Set props("Type")=2
199+
Set props("Recurse")=1
200+
If create {
201+
Write !,"Creating web application: "_name_"... "
202+
$$$ThrowOnError(##class(Security.Applications).Create(name,.props))
203+
Write "done."
204+
} ElseIf ##class(Security.Applications).Exists(name) {
205+
Write !,"Web application '"_name_"' already exists."
206+
$$$ThrowOnError(##class(Security.Applications).Get(name,.existingProps))
207+
Set changes = 0
208+
Set key = ""
209+
For {
210+
Set key = $Order(props(key),1,value)
211+
Quit:key=""
212+
If (value '= $Get(existingProps(key))) {
213+
Write !,"Changing "_key_": "_$Get(existingProps(key))_" -> "_value
214+
Set changes = 1
215+
}
216+
}
217+
If changes {
218+
$$$ThrowOnError(##class(Security.Applications).Modify(name,.props))
219+
Write !,"Web application '"_name_"' updated."
220+
} Else {
221+
Write !,"No changes made to web application."
222+
}
223+
}
224+
}
225+
226+
ClassMethod HasNamespaceWebApp(Output webAppDirectory) As %Boolean
227+
{
228+
Set webAppDirectory = $System.CSP.GetFileName("/git/"_$Namespace_"/")
229+
If (webAppDirectory '= "") {
230+
Set webAppDirectory = ##class(%Library.File).NormalizeDirectory(webAppDirectory)
231+
}
232+
Quit (webAppDirectory '= "")
233+
}
234+
163235
Method OnAfterConfigure() As %Boolean
164236
{
165237
set defaultPromptFlag = $$$DisableBackupCharMask + $$$TrapCtrlCMask + $$$EnableQuitCharMask + $$$DisableHelpCharMask + $$$DisableHelpContextCharMask + $$$TrapErrorMask
@@ -186,6 +258,8 @@ Method OnAfterConfigure() As %Boolean
186258
}
187259
}
188260

261+
do ..ConfigureNamespaceWebApplication()
262+
189263
set gitDir = ##class(%File).NormalizeDirectory(..namespaceTemp)_".git"
190264
if '##class(%File).DirectoryExists(gitDir) {
191265
set list(1) = "Initialize empty repo"

cls/SourceControl/Git/StreamServer.cls

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Class SourceControl.Git.StreamServer Extends %CSP.StreamServer
77
ClassMethod OnPage() As %Status
88
{
99
if (%stream '= $$$NULLOREF) && $data(%base)#2 {
10-
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude()
10+
set sourceControlInclude = ##class(SourceControl.Git.Utils).GetSourceControlInclude(%request.URLPrefix)
1111
while '%stream.AtEnd {
1212
set text = %stream.Read()
1313
set text = $replace(text,"{{baseHref}}",..EscapeHTML(%base))
@@ -19,4 +19,3 @@ ClassMethod OnPage() As %Status
1919
}
2020

2121
}
22-

0 commit comments

Comments
 (0)