diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ae3915..55e2d6b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Deletes are now properly owned by the user who did the delete (#729) - Pull page output now displays better when pull preview shows a lot of changes (#740) +- extensions in item cache are consistently upper-case, so "export all" doesn't duplicate work (#727) ## [2.11.0] - 2025-04-23 diff --git a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls index a639b5c2..d352364c 100644 --- a/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls +++ b/cls/SourceControl/Git/PullEventHandler/IncrementalLoad.cls @@ -100,7 +100,7 @@ Method DeleteFile(item As %String = "", externalName As %String = "") As %Status if deleted && $$$ISOK(sc) { if (item '= "") { do ##class(SourceControl.Git.Utils).RemoveRoutineTSH(item) - kill $$$TrackedItems(##class(SourceControl.Git.Utils).NormalizeExtension(item)) + kill $$$TrackedItems(##class(%Studio.SourceControl.Interface).normalizeName(item)) } } else { if +$system.Status.GetErrorCodes(sc) = $$$ClassDoesNotExist { diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index ce372070..4197bf90 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -765,7 +765,7 @@ ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status #dim i as %Integer #dim ec as %Status = $$$OK for i = 1:1:$length(InternalName, ",") { - #dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i)) + #dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i)) if (item = "") { continue } @@ -781,7 +781,7 @@ ClassMethod AddToSourceControl(InternalName As %String, refreshUncommitted As %B #dim i as %Integer #dim ec as %Status = $$$OK for i = 1:1:$length(InternalName, ",") { - #dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i)) + #dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i)) #dim type as %String = ..Type(.item) #dim sc as %Status = ..ExportItem(item,,1,.filenames) @@ -791,7 +791,7 @@ ClassMethod AddToSourceControl(InternalName As %String, refreshUncommitted As %B for i=1:1:$Get(filenames) { set ignoreNonexistent = (type '= "ptd") - set FileInternalName = ##class(SourceControl.Git.Utils).NormalizeExtension( + set FileInternalName = ##class(%Studio.SourceControl.Interface).normalizeName( ##class(SourceControl.Git.Utils).NameToInternalName(filenames(i), 0,ignoreNonexistent,1)) if (FileInternalName = "") { continue @@ -971,7 +971,7 @@ ClassMethod RemoveFromServerSideSourceControl(InternalName As %String) As %Statu #dim i as %Integer #dim ec as %Status = $$$OK for i = 1:1:$length(InternalName, ",") { - #dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i)) + #dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i)) #dim tsc as %Status = $$$OK #dim type as %String = ..Type(.InternalName) @@ -999,8 +999,8 @@ ClassMethod RemoveFromSourceControl(InternalName As %String, cascadeDelete As %B #dim type as %String = ..Type(.InternalName) set item = $piece(InternalName, ",", i) - if $data(@..#Storage@("items", ..NormalizeExtension(item))) { - set item = ..NormalizeExtension(item) + if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(item))) { + set item = ##class(%Studio.SourceControl.Interface).normalizeName(item) } if $data(@..#Storage@("items", item)) { @@ -1202,21 +1202,21 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A { #dim isInSourceControl as %Boolean = 1 set sourceControlItem = "" - set InternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(InternalName) + set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName) if (InternalName = "") { quit 0 } set context = ##class(SourceControl.Git.PackageManagerContext).%Get() - if $data(@..#Storage@("items", ..NormalizeExtension(InternalName))) { - set InternalName = ..NormalizeExtension(InternalName) + if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))) { + set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName) } set isInSourceControl = $data(@..#Storage@("items", InternalName)) > 0 if isInSourceControl { // Direct reference to namespace-default project set sourceControlItem = InternalName - } elseif context.IsInGitEnabledPackage && (InternalName = ..NormalizeExtension(context.InternalName)) { + } elseif context.IsInGitEnabledPackage && (InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(context.InternalName)) { // Next thing to check is if we're in a package manager-based package set isInSourceControl = 1 set sourceControlItem = context.ResourceReference.Name @@ -1270,7 +1270,7 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B set type = ..Type(.name) if ($extract(name) '= "/") && (type'="csp") { - quit $piece(name,".",1,*-1)_"."_$zconvert($piece(name,".",*),"U") + quit ##class(%Studio.SourceControl.Interface).normalizeName(name) } if (name [ "/") && (type = "csp") { @@ -1289,20 +1289,11 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B quit name } -ClassMethod NormalizeExtension(name As %String) As %String -{ - #dim extension = $piece(name, ".", $length(name, ".")) - if $length(extension) <= 3 { - set $piece(name, ".", $length(name, ".")) = $zconvert(extension, "L") - } - quit name -} - ClassMethod RoutineTSH(InternalName As %String) As %String { #dim type = ..Type(InternalName) //for csp-files (csp,js,html,css, all that stored in csp/...) we always check for changes in external file - #dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ..NormalizeExtension(InternalName)))) + #dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)))) // in case an OS level error is returned set:(($$$isUNIX & (tsh = -2)) || ($$$isWINDOWS & (tsh = -3))) tsh = 0 @@ -1321,13 +1312,13 @@ ClassMethod RoutineTSH(InternalName As %String) As %String ClassMethod UpdateRoutineTSH(InternalName As %String, tsh As %String) As %Status { - set @..#Storage@("TSH", ..NormalizeExtension(InternalName)) = $get(tsh, $h) + set @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)) = $get(tsh, $h) quit $$$OK } ClassMethod RemoveRoutineTSH(InternalName As %String) As %Status { - kill @..#Storage@("TSH", ..NormalizeExtension(InternalName)) + kill @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)) quit $$$OK } @@ -2272,12 +2263,14 @@ ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0) set list = $listfromstring(lines, $char(0)) set pointer = 0 while $listnext(list, pointer, item) { - set operation = $zstrip($extract(item, 1, 2), "W") set externalName = $extract(item, 4, *) set internalName = ..NameToInternalName(externalName,,0) if (internalName '= "") { set files(internalName) = $listbuild(operation, externalName) - set @..#Storage@("items",..NormalizeInternalName(internalName)) = "" + if (operation '= "D") { + set @..#Storage@("items",..NormalizeInternalName(internalName)) = "" + } } elseif ((IncludeAllFiles) && (externalName '= "")) { set externalName = $TRANSLATE(externalName, "\", "/") set files($I(files)) = $listbuild(operation, externalName) @@ -2399,8 +2392,8 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S if InternalName["/" { // If no specific mapping was specified (p=""), then return the whole csp filename; otherwise return the name without the mapped piece - set InternalName=$extract(InternalName,$length(p)+2,*) - quit $translate(found_$translate(InternalName,"%","_"),"\","/") + set relativeInternalName=$extract(InternalName,$length(p)+2,*) + quit $translate(found_$translate(relativeInternalName,"%","_"),"\","/") } elseif (..Type(InternalName) = "ptd") { do ##class(SourceControl.Git.Production).ParseInternalName(InternalName,'default,.filename) return $translate(found_filename, "\","/")