Skip to content

Add Business Processess if they are not in source control #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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.9.1] - Unreleased

### Fixed
- Fixed business processes and rules not being added to source control automatically (#676)

## [2.9.0] - 2025-01-09

### Added
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)
}
}
}

}
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.9.0</Version>
<Version>2.9.1</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
Loading