@@ -418,9 +418,9 @@ ClassMethod NormalizeFolder(folder As %String) As %String
418418 quit folder
419419}
420420
421- ClassMethod ExternalName (InternalName As %String ) As %String
421+ ClassMethod ExternalName (InternalName As %String , ByRef MappingExists As %Boolean ) As %String
422422{
423- quit ..Name (InternalName )
423+ quit ..Name (InternalName ,. MappingExists )
424424}
425425
426426ClassMethod AddToServerSideSourceControl (InternalName As %String ) As %Status
@@ -446,10 +446,6 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status
446446 #dim item as %String = ..NormalizeExtension ($piece (InternalName , " ," , i ))
447447 #dim type as %String = ..Type (item )
448448
449- if ((type '= " pkg" ) && (type '= " prj" )){
450- set @..#Storage@(" items" , item ) = " "
451- }
452-
453449 #dim sc as %Status = ..ExportItem (item ,,1 ,.filenames )
454450 if 'sc {
455451 set ec = $$$ADDSC(ec , sc )
@@ -458,8 +454,6 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status
458454 set FileInternalName = ##class (SourceControl.Git.Utils ).NameToInternalName (filenames (i ), 0 )
459455 set FileType = ##class (SourceControl.Git.Utils ).Type (FileInternalName )
460456
461- continue :..NormalizeExtension (FileInternalName )=item
462- continue :$DATA (@..#Storage@(" items" , FileInternalName ))
463457 set @..#Storage@(" items" , FileInternalName ) = " "
464458 do ..RunGitCommand (" add" ,.errStream ,.outStream ,filenames (i ))
465459 write !, " Added " , FileInternalName , " to source control."
@@ -890,9 +884,9 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A
890884 quit isInSourceControl
891885}
892886
893- ClassMethod FullExternalName (InternalName As %String ) As %String [ CodeMode = expression ]
887+ ClassMethod FullExternalName (InternalName As %String , ByRef MappingExists As %Boolean ) As %String [ CodeMode = expression ]
894888{
895- ##class (%File ).NormalizeFilename (..TempFolder ()_..ExternalName (InternalName ))
889+ ##class (%File ).NormalizeFilename (..TempFolder ()_..ExternalName (InternalName , . MappingExists ))
896890}
897891
898892ClassMethod NormalizeInternalName (name As %String ) As %String
@@ -1220,7 +1214,11 @@ ClassMethod ExportItem(InternalName As %String, expand As %Boolean = 1, force As
12201214 $$$QuitOnError(..ExportRoutinesAux (InternalName , " /" , 0 , force , .filenames ))
12211215 }else {
12221216 if ..IsTempFileOutdated (InternalName ) || force {
1223- #dim filename as %String = ..FullExternalName (InternalName )
1217+ #dim filename as %String = ..FullExternalName (InternalName , .MappingExists )
1218+ if (MappingExists = 0 ){
1219+ write " Did not find a matching mapping for " " " _InternalName _" " " . Skipping export."
1220+ quit $$$OK
1221+ }
12241222 set filenames ($I (filenames )) = filename
12251223 write !, " exporting new version of " , InternalName , " to " , filename
12261224 $$$QuitOnError($system .OBJ .ExportUDL (InternalName , filename ," -d/diff" ))
@@ -1387,8 +1385,10 @@ ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0)
13871385 Name(InternalName): returns Unix-style slash path relative to repo root cooresponding to internal name
13881386 (e.g., cls/SourceControl/Git/Utils.cls)
13891387*/
1390- ClassMethod Name (InternalName As %String ) As %String
1388+ ClassMethod Name (InternalName As %String , ByRef MappingExists As %Boolean ) As %String
13911389{
1390+
1391+ set MappingExists = -1
13921392 set InternalName =##class (%Studio.SourceControl.Interface ).normalizeName (InternalName )
13931393 set context = ##class (SourceControl.Git.PackageManagerContext ).%Get ()
13941394 if (context .IsInGitEnabledPackage ) && (InternalName = context .InternalName ) && $isobject (context .ResourceReference ) {
@@ -1475,9 +1475,14 @@ ClassMethod Name(InternalName As %String) As %String
14751475 set default =0
14761476 } elseif $data (found )=0 {
14771477 set found = $zconvert (ext ," L" )_" /"
1478+ set MappingExists = 0
14781479 }
14791480 }
14801481
1482+ if (MappingExists '= 0 ){
1483+ set MappingExists = 1
1484+ }
1485+
14811486 if InternalName [" /" {
14821487 // If no specific mapping was specified (p=""), then return the whole csp filename; otherwise return the name without the mapped piece
14831488 set InternalName =$extract (InternalName ,$length (p )+2 ,*)
@@ -1513,7 +1518,7 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1) A
15131518 if (##class (%File ).Exists (Name )) {
15141519 new %SourceControl //don't trigger source hooks with this test load to get the Name
15151520 set sc =$system .OBJ .Load (Name ," -d" ,,.outName ,1 )
1516- if ($data (outName )=1 ) || ($data (outName ) = 11 && ($order (outName (" " ),-1 ) = $order (outName (" " )))) {
1521+ if (( $data (outName )=1 ) || ($data (outName ) = 11 && ($order (outName (" " ),-1 ) = $order (outName (" " ))))) && ( $zconvert (.. Type ( outName ), " U " ) '= " CSP " ) {
15171522 //only set if a single Name was returned ... ignore multi-item files
15181523 set InternalName =outName
15191524 }
@@ -1616,4 +1621,3 @@ ClassMethod GetSourceControlInclude() As %String
16161621}
16171622
16181623}
1619-
0 commit comments