Skip to content

Commit fdd4928

Browse files
authored
Merge pull request #751 from intersystems/fix-item-cache-case
Fix inconsistent casing in items cache
2 parents 5ee26a9 + b13adef commit fdd4928

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Fixed
1616
- Deletes are now properly owned by the user who did the delete (#729)
1717
- Pull page output now displays better when pull preview shows a lot of changes (#740)
18+
- Extensions in item cache are consistently upper-case, so "export all" doesn't duplicate work (#727)
1819
- Fixed loop of loading classes with compilation errors in Studio (#766)
1920
- Fixed error popup when creating new record map or other interop items (#753)
2021
- Changing remotes in the git project settings pages now works if remote is not already defined (#746)

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: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ ClassMethod AddToServerSideSourceControl(InternalName As %String) As %Status
770770
#dim i as %Integer
771771
#dim ec as %Status = $$$OK
772772
for i = 1:1:$length(InternalName, ",") {
773-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
773+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
774774
if (item = "") {
775775
continue
776776
}
@@ -786,7 +786,7 @@ ClassMethod AddToSourceControl(InternalName As %String, refreshUncommitted As %B
786786
#dim i as %Integer
787787
#dim ec as %Status = $$$OK
788788
for i = 1:1:$length(InternalName, ",") {
789-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
789+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
790790
#dim type as %String = ..Type(.item)
791791

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

797797
for i=1:1:$Get(filenames) {
798798
set ignoreNonexistent = (type '= "ptd")
799-
set FileInternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(
799+
set FileInternalName = ##class(%Studio.SourceControl.Interface).normalizeName(
800800
##class(SourceControl.Git.Utils).NameToInternalName(filenames(i), 0,ignoreNonexistent,1))
801801
if (FileInternalName = "") {
802802
continue
@@ -976,7 +976,7 @@ ClassMethod RemoveFromServerSideSourceControl(InternalName As %String) As %Statu
976976
#dim i as %Integer
977977
#dim ec as %Status = $$$OK
978978
for i = 1:1:$length(InternalName, ",") {
979-
#dim item as %String = ..NormalizeExtension($piece(InternalName, ",", i))
979+
#dim item as %String = ##class(%Studio.SourceControl.Interface).normalizeName($piece(InternalName, ",", i))
980980
#dim tsc as %Status = $$$OK
981981
#dim type as %String = ..Type(.InternalName)
982982

@@ -1004,8 +1004,8 @@ ClassMethod RemoveFromSourceControl(InternalName As %String, cascadeDelete As %B
10041004
#dim type as %String = ..Type(.InternalName)
10051005

10061006
set item = $piece(InternalName, ",", i)
1007-
if $data(@..#Storage@("items", ..NormalizeExtension(item))) {
1008-
set item = ..NormalizeExtension(item)
1007+
if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(item))) {
1008+
set item = ##class(%Studio.SourceControl.Interface).normalizeName(item)
10091009
}
10101010

10111011
if $data(@..#Storage@("items", item)) {
@@ -1207,21 +1207,21 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A
12071207
{
12081208
#dim isInSourceControl as %Boolean = 1
12091209
set sourceControlItem = ""
1210-
set InternalName = ##class(SourceControl.Git.Utils).NormalizeExtension(InternalName)
1210+
set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)
12111211
if (InternalName = "") {
12121212
quit 0
12131213
}
12141214

12151215
set context = ##class(SourceControl.Git.PackageManagerContext).%Get()
1216-
if $data(@..#Storage@("items", ..NormalizeExtension(InternalName))) {
1217-
set InternalName = ..NormalizeExtension(InternalName)
1216+
if $data(@..#Storage@("items", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))) {
1217+
set InternalName = ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)
12181218
}
12191219

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

12801280
if ($extract(name) '= "/") && (type'="csp") {
1281-
quit $piece(name,".",1,*-1)_"."_$zconvert($piece(name,".",*),"U")
1281+
quit ##class(%Studio.SourceControl.Interface).normalizeName(name)
12821282
}
12831283

12841284
if (name [ "/") && (type = "csp") {
@@ -1297,20 +1297,11 @@ ClassMethod NormalizeInternalName(ByRef name As %String, Output fromWebApp As %B
12971297
quit name
12981298
}
12991299

1300-
ClassMethod NormalizeExtension(name As %String) As %String
1301-
{
1302-
#dim extension = $piece(name, ".", $length(name, "."))
1303-
if $length(extension) <= 3 {
1304-
set $piece(name, ".", $length(name, ".")) = $zconvert(extension, "L")
1305-
}
1306-
quit name
1307-
}
1308-
13091300
ClassMethod RoutineTSH(InternalName As %String) As %String
13101301
{
13111302
#dim type = ..Type(InternalName)
13121303
//for csp-files (csp,js,html,css, all that stored in csp/...) we always check for changes in external file
1313-
#dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ..NormalizeExtension(InternalName))))
1304+
#dim tsh = $case(type,"csp":"",:$get(@..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))))
13141305

13151306
// in case an OS level error is returned
13161307
set:(($$$isUNIX & (tsh = -2)) || ($$$isWINDOWS & (tsh = -3))) tsh = 0
@@ -1329,13 +1320,13 @@ ClassMethod RoutineTSH(InternalName As %String) As %String
13291320

13301321
ClassMethod UpdateRoutineTSH(InternalName As %String, tsh As %String) As %Status
13311322
{
1332-
set @..#Storage@("TSH", ..NormalizeExtension(InternalName)) = $get(tsh, $h)
1323+
set @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName)) = $get(tsh, $h)
13331324
quit $$$OK
13341325
}
13351326

13361327
ClassMethod RemoveRoutineTSH(InternalName As %String) As %Status
13371328
{
1338-
kill @..#Storage@("TSH", ..NormalizeExtension(InternalName))
1329+
kill @..#Storage@("TSH", ##class(%Studio.SourceControl.Interface).normalizeName(InternalName))
13391330
quit $$$OK
13401331
}
13411332

@@ -2280,12 +2271,14 @@ ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0)
22802271
set list = $listfromstring(lines, $char(0))
22812272
set pointer = 0
22822273
while $listnext(list, pointer, item) {
2283-
set operation = $zstrip($extract(item, 1, 2), "<W")
2274+
set operation = $zstrip($extract(item, 1, 2), "<>W")
22842275
set externalName = $extract(item, 4, *)
22852276
set internalName = ..NameToInternalName(externalName,,0)
22862277
if (internalName '= "") {
22872278
set files(internalName) = $listbuild(operation, externalName)
2288-
set @..#Storage@("items",..NormalizeInternalName(internalName)) = ""
2279+
if (operation '= "D") {
2280+
set @..#Storage@("items",..NormalizeInternalName(internalName)) = ""
2281+
}
22892282
} elseif ((IncludeAllFiles) && (externalName '= "")) {
22902283
set externalName = $TRANSLATE(externalName, "\", "/")
22912284
set files($I(files)) = $listbuild(operation, externalName)
@@ -2407,8 +2400,8 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
24072400

24082401
if InternalName["/" {
24092402
// If no specific mapping was specified (p=""), then return the whole csp filename; otherwise return the name without the mapped piece
2410-
set InternalName=$extract(InternalName,$length(p)+2,*)
2411-
quit $translate(found_$translate(InternalName,"%","_"),"\","/")
2403+
set relativeInternalName=$extract(InternalName,$length(p)+2,*)
2404+
quit $translate(found_$translate(relativeInternalName,"%","_"),"\","/")
24122405
} elseif (..Type(InternalName) = "ptd") {
24132406
do ##class(SourceControl.Git.Production).ParseInternalName(InternalName,'default,.filename)
24142407
return $translate(found_filename, "\","/")

0 commit comments

Comments
 (0)