Skip to content

Commit 2ddb19a

Browse files
committed
Merge branch 'main' of https://github.com/intersystems/git-source-control into cd-decomp
2 parents 70eb962 + 4f1f989 commit 2ddb19a

File tree

7 files changed

+48
-8
lines changed

7 files changed

+48
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ 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

13+
### Fixed
14+
- Fixed not showing warnings on Studio (#660)
15+
- Fixed business processes and rules not being added to source control automatically (#676)
16+
- Embedded Git commits settings when cloning empty repo to avert any issues
17+
1318
## [2.9.0] - 2025-01-09
1419

1520
### Added

cls/SourceControl/Git/Extension.cls

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
5959
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
6060
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
6161
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
62+
63+
// Deal with Business Processes and Rules
64+
// Note: Business Processes and Rules do not have a 'new document' User Action, and thus must be added like this
65+
if (('isInSourceControl)) {
66+
do ..CheckBusinessProcessesAndRules(InternalName)
67+
}
68+
6269
if '$data(tAction) {
6370
set user = "", inNamespace = ""
6471
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
@@ -371,6 +378,8 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
371378
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
372379
}
373380
}
381+
} else {
382+
do ..CheckBusinessProcessesAndRules(InternalName)
374383
}
375384
}
376385
} catch e {
@@ -535,4 +544,18 @@ Method CheckCommitterIdentity(Settings As SourceControl.Git.Settings, ByRef Acti
535544
return 0
536545
}
537546

547+
/// Deal with Business Processes and Rules
548+
Method CheckBusinessProcessesAndRules(InternalName As %String) As %Status
549+
{
550+
// Note: Business Processes and Rules are not added through normal user action processes because of upstream hook issues,
551+
// so we have to add them like this
552+
if (##class(SourceControl.Git.Utils).Type(InternalName) = "cls") {
553+
set name = $piece(InternalName,".CLS",1)
554+
set exists = ##class(%Dictionary.CompiledClass).%ExistsId(name)
555+
if (exists && ($classmethod(name,"%Extends","Ens.BusinessProcess") || $classmethod(name,"%Extends","Ens.Rule.Definition"))) {
556+
do ..AddToSourceControl(InternalName)
557+
}
558+
}
559+
}
560+
538561
}

cls/SourceControl/Git/Settings.cls

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,15 @@ Method OnAfterConfigure() As %Boolean
448448
$$$ThrowOnError(workMgr.WaitForComplete())
449449
// export settings file without committing
450450
$$$ThrowOnError(..SaveWithSourceControl())
451+
452+
// Empty repo breaks Embedded Git, commit the settings file
453+
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("log",,.errStream,.outStream)
454+
do errStream.Rewind()
455+
if (errStream.Read() [ "does not have any commits yet") {
456+
w !,"Cloned Empty Repository, committing initial source control settings",!
457+
$$$ThrowOnError(##class(SourceControl.Git.Utils).AddToSourceControl(##class(SourceControl.Git.Settings.Document).#INTERNALNAME))
458+
$$$ThrowOnError(##class(SourceControl.Git.Utils).Commit(##class(SourceControl.Git.Settings.Document).#INTERNALNAME,"initial commit"))
459+
}
451460
}
452461
}
453462
}
227 KB
Loading

docs/production-decomposition.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Production Decomposition
22
Production Decomposition is a feature of Embedded Git that allows multiple developers to edit the same IRIS Interoperability production in the same namespace. In the past, the production class has been an obstacle preventing organizations using multi-user development namespaces from adopting source control. Production Decomposition resolves this by representing the production as a directory of files for each production item that may be edited independently. An uncommitted change to the settings for a single item through the Interoperability Portal will block other users from editing that item while allowing changes to other items in the production.
33

4+
5+
![Productions in Git](images/production-decomposition.png)
6+
47
## Enabling production decomposition
58
The feature may be enabled by checking the "Decompose Productions" box in the Git Settings page. For deployment of changes to other environments through git to work properly, the value of this setting must match on all namespaces connected to this repository. To assist, settings are automatically exported into a `embedded-git-config.json` file at the root of the repository that may be committed and imported into other environments.
69

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ webui.parseGitResponse = function(data) {
146146
};
147147
}
148148

149-
webui.processGitResponse = function(data, command, callback) {
149+
webui.processGitResponse = function(data, command, callback, warningCallback) {
150150
var result = webui.parseGitResponse(data);
151151
var rcode = result.rcode;
152152
var output = result.output;
@@ -158,7 +158,7 @@ webui.processGitResponse = function(data, command, callback) {
158158
}
159159
// Return code is 0 but there is stderr output: this is a warning message
160160
if (message.length > 0) {
161-
if(warningCallback) {
161+
if (warningCallback) {
162162
warningCallback(message);
163163
} else {
164164
webui.showWarning(message);
@@ -185,7 +185,7 @@ webui.processGitResponse = function(data, command, callback) {
185185
}
186186
}
187187

188-
webui.git_command = function(command, callback) {
188+
webui.git_command = function(command, callback, warningCallback) {
189189
$.ajax({
190190
url: "git-command",
191191
type: "POST",
@@ -194,7 +194,7 @@ webui.git_command = function(command, callback) {
194194
command: command
195195
}),
196196
success: function(data) {
197-
webui.processGitResponse(data, command, callback);
197+
webui.processGitResponse(data, command, callback, warningCallback);
198198
},
199199
error: function(data) {
200200
var trimmedData = data.replace(/(\r\n)/gm, "\n");

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ webui.parseGitResponse = function(data) {
146146
};
147147
}
148148

149-
webui.processGitResponse = function(data, command, callback) {
149+
webui.processGitResponse = function(data, command, callback, warningCallback) {
150150
var result = webui.parseGitResponse(data);
151151
var rcode = result.rcode;
152152
var output = result.output;
@@ -158,7 +158,7 @@ webui.processGitResponse = function(data, command, callback) {
158158
}
159159
// Return code is 0 but there is stderr output: this is a warning message
160160
if (message.length > 0) {
161-
if(warningCallback) {
161+
if (warningCallback) {
162162
warningCallback(message);
163163
} else {
164164
webui.showWarning(message);
@@ -185,7 +185,7 @@ webui.processGitResponse = function(data, command, callback) {
185185
}
186186
}
187187

188-
webui.git_command = function(command, callback) {
188+
webui.git_command = function(command, callback, warningCallback) {
189189
$.ajax({
190190
url: "git-command",
191191
type: "POST",
@@ -194,7 +194,7 @@ webui.git_command = function(command, callback) {
194194
command: command
195195
}),
196196
success: function(data) {
197-
webui.processGitResponse(data, command, callback);
197+
webui.processGitResponse(data, command, callback, warningCallback);
198198
},
199199
error: function(data) {
200200
var trimmedData = data.replace(/(\r\n)/gm, "\n");

0 commit comments

Comments
 (0)