From 19c04f0e6696f6b2a0d06e0165f3ee5ed8e3b4aa Mon Sep 17 00:00:00 2001 From: Elijah Tamarchenko Date: Fri, 25 Oct 2024 14:51:26 -0400 Subject: [PATCH 1/3] Added suppression of locked classes --- CHANGELOG.md | 1 + cls/SourceControl/Git/Extension.cls | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94069088..ebaeb540 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix errors on commit when a file was added, never committed, then deleted from the repository (#481) - Fixed issue with saving multiple new no-folder mapping settings at the same time (#533) - Fixed sending OS error when git pull encounters error (#545) +- Fixed suppressing editing of locked classes (#301) ## [2.6.0] - 2024-10-07 diff --git a/cls/SourceControl/Git/Extension.cls b/cls/SourceControl/Git/Extension.cls index 9805b292..1a6a2d39 100644 --- a/cls/SourceControl/Git/Extension.cls +++ b/cls/SourceControl/Git/Extension.cls @@ -67,6 +67,13 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se set Action = 6 } } + + do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut) + if 'isEditable || ##class(SourceControl.Git.Utils).Locked() || ($username '= userCheckedOut) { + set Target = "Warning: Attempting to edit read-only file" + write !, Target + set Action = 6 + } } } From 639f4daffb4df9c292cb2fb1d9683052f9c1ddfc Mon Sep 17 00:00:00 2001 From: Elijah Tamarchenko Date: Fri, 25 Oct 2024 14:54:59 -0400 Subject: [PATCH 2/3] Fixed lock warning --- cls/SourceControl/Git/Extension.cls | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cls/SourceControl/Git/Extension.cls b/cls/SourceControl/Git/Extension.cls index 1a6a2d39..85ff64ca 100644 --- a/cls/SourceControl/Git/Extension.cls +++ b/cls/SourceControl/Git/Extension.cls @@ -59,21 +59,19 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se // if item is being edited in a different namespace, opening it will display an alert. Editing in this namespace will remove the alert. set filename = ##class(SourceControl.Git.Utils).FullExternalName(.InternalName) do ##class(SourceControl.Git.Change).GetUncommitted(filename,.tAction) + do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut) if '$data(tAction) { set user = "", inNamespace = "" if ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) { set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "." write !, Target set Action = 6 + } elseif 'isEditable || ##class(SourceControl.Git.Utils).Locked() { + set Target = "Warning: Attempting to edit read-only file" + write !, Target + set Action = 6 } } - - do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut) - if 'isEditable || ##class(SourceControl.Git.Utils).Locked() || ($username '= userCheckedOut) { - set Target = "Warning: Attempting to edit read-only file" - write !, Target - set Action = 6 - } } } From 5a78a6de8dab96b3e06dcf24728cfa1896990ee2 Mon Sep 17 00:00:00 2001 From: Elijah Tamarchenko Date: Fri, 25 Oct 2024 16:35:48 -0400 Subject: [PATCH 3/3] Changed ordering --- cls/SourceControl/Git/Extension.cls | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cls/SourceControl/Git/Extension.cls b/cls/SourceControl/Git/Extension.cls index 85ff64ca..1b5d6ce4 100644 --- a/cls/SourceControl/Git/Extension.cls +++ b/cls/SourceControl/Git/Extension.cls @@ -62,15 +62,15 @@ Method UserAction(Type As %Integer, Name As %String, InternalName As %String, Se do ..GetStatus(.InternalName, .isInSourceControl, .isEditable,.isCheckedOut,.userCheckedOut) if '$data(tAction) { set user = "", inNamespace = "" - if ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) { - set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "." + if 'isEditable || ##class(SourceControl.Git.Utils).Locked() { + set Target = "Warning: Attempting to edit read-only file" write !, Target set Action = 6 - } elseif 'isEditable || ##class(SourceControl.Git.Utils).Locked() { - set Target = "Warning: Attempting to edit read-only file" + } elseif ##class(SourceControl.Git.Utils).InstanceWideUncommittedCheck(InternalName, .user, .inNamespace) { + set Target = "Warning: Item " _ InternalName _ " is currently being modified by " _ user _ " in namespace " _ inNamespace _ "." write !, Target set Action = 6 - } + } } } }