Skip to content

Commit

Permalink
Merge pull request #686 from intersystems/issue-676
Browse files Browse the repository at this point in the history
Add Business Processess if they are not in source control
  • Loading branch information
isc-tleavitt authored Jan 14, 2025
2 parents eba6df6 + ff56e81 commit ea587ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.9.1] - Unreleased

### Fixed
- 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

## [2.9.0] - 2025-01-09
Expand Down
23 changes: 23 additions & 0 deletions cls/SourceControl/Git/Extension.cls
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)

// Deal with Business Processes and Rules
// Note: Business Processes and Rules do not have a 'new document' User Action, and thus must be added like this
if (('isInSourceControl)) {
do ..CheckBusinessProcessesAndRules(InternalName)
}

if '$data(tAction) {
set user = "", inNamespace = ""
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
Expand Down Expand Up @@ -371,6 +378,8 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
}
}
} else {
do ..CheckBusinessProcessesAndRules(InternalName)
}
}
} catch e {
Expand Down Expand Up @@ -535,4 +544,18 @@ Method CheckCommitterIdentity(Settings As SourceControl.Git.Settings, ByRef Acti
return 0
}

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

}

0 comments on commit ea587ed

Please sign in to comment.