Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 09afb83

Browse files
committedApr 25, 2025·
refactor: remove NormalizeExtension
1 parent 84d0a59 commit 09afb83

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed
 

‎cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Method DeleteFile(item As %String = "", externalName As %String = "") As %Status
100100
if deleted && $$$ISOK(sc) {
101101
if (item '= "") {
102102
do ##class(SourceControl.Git.Utils).RemoveRoutineTSH(item)
103-
kill $$$TrackedItems(##class(SourceControl.Git.Utils).NormalizeExtension(item))
103+
kill $$$TrackedItems(##class(%Studio.SourceControl.Interface).normalizeName(item))
104104
}
105105
} else {
106106
if +$system.Status.GetErrorCodes(sc) = $$$ClassDoesNotExist {

‎cls/SourceControl/Git/Utils.cls

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
765765
#dim i as %Integer
766766
#dim ec as %Status = $$$OK
767767
for i = 1:1:$length(InternalName, ",") {
768-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
768+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
769769
if (item = "") {
770770
continue
771771
}
@@ -781,7 +781,7 @@ ClassMethod AddToSourceControl(InternalName As %String, refreshUncommitted As %B
781781
#dim i as %Integer
782782
#dim ec as %Status = $$$OK
783783
for i = 1:1:$length(InternalName, ",") {
784-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
784+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
785785
#dim type as %String = ..Type(.item)
786786

787787
#dim sc as %Status = ..ExportItem(item,,1,.filenames)
@@ -791,7 +791,7 @@ ClassMethod AddToSourceControl(InternalName As %String, refreshUncommitted As %B
791791

792792
for i=1:1:$Get(filenames) {
793793
set ignoreNonexistent = (type '= "ptd")
794-
set FileInternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(
794+
set FileInternalName = ##class(%Studio.SourceControl.Interface).normalizeName(
795795
##class(SourceControl.Git.Utils).NameToInternalName(filenames(i), 0,ignoreNonexistent,1))
796796
if (FileInternalName = "") {
797797
continue
@@ -971,7 +971,7 @@ ClassMethod RemoveFromServerSideSourceControl(InternalName As %String) As %Statu
971971
#dim i as %Integer
972972
#dim ec as %Status = $$$OK
973973
for i = 1:1:$length(InternalName, ",") {
974-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
974+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
975975
#dim tsc as %Status = $$$OK
976976
#dim type as %String = ..Type(.InternalName)
977977

@@ -999,8 +999,8 @@ ClassMethod RemoveFromSourceControl(InternalName As %String, cascadeDelete As %B
999999
#dim type as %String = ..Type(.InternalName)
10001000

10011001
set item = $piece(InternalName, ",", i)
1002-
if $data(@..#Storage@("items", ..NormalizeExtension(item))) {
1003-
set item = ..NormalizeExtension(item)
1002+
if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(item))) {
1003+
set item = ##class(%Studio.SourceControl.Interface).normalizeName(item)
10041004
}
10051005

10061006
if $data(@..#Storage@("items", item)) {
@@ -1202,21 +1202,21 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A
12021202
{
12031203
#dim isInSourceControl as %Boolean = 1
12041204
set sourceControlItem = ""
1205-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(InternalName)
1205+
set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)
12061206
if (InternalName = "") {
12071207
quit 0
12081208
}
12091209

12101210
set context = ##class(SourceControl.Git.PackageManagerContext).%Get()
1211-
if $data(@..#Storage@("items", ..NormalizeExtension(InternalName))) {
1212-
set InternalName = ..NormalizeExtension(InternalName)
1211+
if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))) {
1212+
set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)
12131213
}
12141214

12151215
set isInSourceControl = $data(@..#Storage@("items", InternalName)) > 0
12161216
if isInSourceControl {
12171217
// Direct reference to namespace-default project
12181218
set sourceControlItem = InternalName
1219-
} elseif context.IsInGitEnabledPackage && (InternalName = ..NormalizeExtension(context.InternalName)) {
1219+
} elseif context.IsInGitEnabledPackage && (InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(context.InternalName)) {
12201220
// Next thing to check is if we're in a package manager-based package
12211221
set isInSourceControl = 1
12221222
set sourceControlItem = context.ResourceReference.Name
@@ -1270,7 +1270,7 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B
12701270
set type = ..Type(.name)
12711271

12721272
if ($extract(name) '= "/") && (type'="csp") {
1273-
quit ..NormalizeExtension(name)
1273+
quit ##class(%Studio.SourceControl.Interface).normalizeName(name)
12741274
}
12751275

12761276
if (name [ "/") && (type = "csp") {
@@ -1289,16 +1289,11 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B
12891289
quit name
12901290
}
12911291

1292-
ClassMethod NormalizeExtension(name As %String) As %String
1293-
{
1294-
return ##class(%Studio.SourceControl.Interface).normalizeName(name)
1295-
}
1296-
12971292
ClassMethod RoutineTSH(InternalName As %String) As %String
12981293
{
12991294
#dim type = ..Type(InternalName)
13001295
//for csp-files (csp,js,html,css, all that stored in csp/...) we always check for changes in external file
1301-
#dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ..NormalizeExtension(InternalName))))
1296+
#dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))))
13021297

13031298
// in case an OS level error is returned
13041299
set:(($$$isUNIX & (tsh = -2)) || ($$$isWINDOWS & (tsh = -3))) tsh = 0
@@ -1317,13 +1312,13 @@ ClassMethod RoutineTSH(InternalName As %String) As %String
13171312

13181313
ClassMethod UpdateRoutineTSH(InternalName As %String, tsh As %String) As %Status
13191314
{
1320-
set @..#Storage@("TSH", ..NormalizeExtension(InternalName)) = $get(tsh, $h)
1315+
set @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)) = $get(tsh, $h)
13211316
quit $$$OK
13221317
}
13231318

13241319
ClassMethod RemoveRoutineTSH(InternalName As %String) As %Status
13251320
{
1326-
kill @..#Storage@("TSH", ..NormalizeExtension(InternalName))
1321+
kill @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))
13271322
quit $$$OK
13281323
}
13291324

0 commit comments

Comments
 (0)
Please sign in to comment.