Skip to content

Commit 06bf623

Browse files
authored
Merge pull request #674 from intersystems/decomp-instance-wide
Fixes to instance-wide uncommitted queue
2 parents 8f69b52 + e1faca2 commit 06bf623

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Fixed errors on production page when item settings need to be XML escaped (#667)
1515
- Fixed push button not appearing after commit (#654)
1616
- Fixed merge conflict resolution on stash popping (#531)
17+
- Improvements to the performance of the instance-wide uncommitted check (#674)
1718
- Fix "Max $ZF String" error when committing lots of files (#617)
18-
19+
1920
## [2.8.0] - 2024-12-06
2021

2122
### Added

cls/SourceControl/Git/Change.cls

+9-8
Original file line numberDiff line numberDiff line change
@@ -202,24 +202,25 @@ Query InstanceUncommitted() As %Query(ROWSPEC = "InternalName:%String,User:%Stri
202202

203203
ClassMethod InstanceUncommittedExecute(ByRef qHandle As %Binary) As %Status
204204
{
205-
set qHandle("q") = "SELECT InternalName, ChangedBy FROM SourceControl_Git.Change"
205+
set initNS = $namespace
206206
&sql(DECLARE InstanceCursor CURSOR FOR SELECT InternalName, ChangedBy into :internalName, :changedBy from SourceControl_Git.Change)
207207
set namespaces = ##class(SourceControl.Git.Utils).GetGitEnabledNamespaces()
208208
set tPtr = 0
209209
set qHandle("i") = 1
210210
new $namespace
211+
kill ^||InstanceUncommitted
211212
while $LISTNEXT(namespaces, tPtr, tValue) {
212213
set namespace = $ZCONVERT(tValue, "U")
213-
if '(namespace [ "^") {
214+
if '(namespace [ "^") && (namespace '= initNS) {
214215
set $NAMESPACE = namespace
215216

216217
&sql(OPEN InstanceCursor)
217218
throw:SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE, %msg)
218219
&sql(FETCH InstanceCursor)
219220
while(SQLCODE = 0) {
220-
set qHandle("changes", $increment(qHandle("changes")), "InternalName") = internalName
221-
set qHandle("changes", qHandle("changes"), "User") = changedBy
222-
set qHandle("changes", qHandle("changes"), "Namespace") = namespace
221+
set ^||InstanceUncommitted("changes", $increment(^||InstanceUncommitted("changes")), "InternalName") = internalName
222+
set ^||InstanceUncommitted("changes", ^||InstanceUncommitted("changes"), "User") = changedBy
223+
set ^||InstanceUncommitted("changes", ^||InstanceUncommitted("changes"), "Namespace") = namespace
223224
&sql(FETCH InstanceCursor)
224225
}
225226
&sql(CLOSE InstanceCursor)
@@ -232,10 +233,10 @@ ClassMethod InstanceUncommittedExecute(ByRef qHandle As %Binary) As %Status
232233
ClassMethod InstanceUncommittedFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = InstanceUncommittedExecute ]
233234
{
234235
set i = qHandle("i")
235-
if $data(qHandle("changes",i))=10 {
236-
set Row = $listbuild(qHandle("changes", i, "InternalName"), qHandle("changes", i, "User"), qHandle("changes", i, "Namespace"))
236+
if $data(^||InstanceUncommitted("changes",i))=10 {
237+
set Row = $listbuild(^||InstanceUncommitted("changes", i, "InternalName"), ^||InstanceUncommitted("changes", i, "User"), ^||InstanceUncommitted("changes", i, "Namespace"))
237238
}
238-
if i >= $get(qHandle("changes"),0) {
239+
if i >= $get(^||InstanceUncommitted("changes"),0) {
239240
set AtEnd = 1
240241
} else {
241242
set qHandle("i") = $increment(qHandle("i"))

cls/SourceControl/Git/Extension.cls

+17-17
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se
5656
}
5757

5858
if (Type = 1) && (Name = 3) {
59-
if settings.warnInstanceWideUncommitted {
60-
// if item is being edited in a different namespace, opening it will display an alert. Editing in this namespace will remove the alert.
61-
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
62-
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
63-
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
64-
if '$data(tAction) {
65-
set user = "", inNamespace = ""
66-
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
67-
set Target = "Warning: Attempting to edit read-only file"
68-
write !, Target
69-
set Action = 6
70-
} elseif ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
71-
set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "."
72-
write !, Target
73-
set Action = 6
74-
}
75-
}
59+
set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName)
60+
do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction)
61+
do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut)
62+
if '$data(tAction) {
63+
set user = "", inNamespace = ""
64+
if 'isEditable || ##class(SourceControl.Git.Utils).Locked() {
65+
set Target = "Warning: Attempting to edit read-only file"
66+
write !, Target
67+
set Action = 6
68+
} elseif settings.warnInstanceWideUncommitted
69+
&& '(##class(SourceControl.Git.Utils).ItemIsProductionToDecompose(InternalName))
70+
&& ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) {
71+
// if item is being edited in a different namespace, opening it will display an alert. Editing in this namespace will remove the alert.
72+
set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "."
73+
write !, Target
74+
set Action = 6
75+
}
7676
}
7777
}
7878

0 commit comments

Comments
 (0)