@@ -285,7 +285,7 @@ ClassMethod Revert(InternalName As %String) As %Status
285
285
set filename = ..FullExternalName (.InternalName )
286
286
do ..RunGitCommand (" checkout" , .errStream , .outStream , " --" , filename )
287
287
$$$QuitOnError(##class (SourceControl.Git.Change ).RemoveUncommitted (filename ,0 ,1 ))
288
- $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (0 ,1 ))
288
+ $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (0 ,1 ,, 1 ))
289
289
$$$QuitOnError(..ImportItem (InternalName ,1 ))
290
290
quit $$$OK
291
291
}
@@ -299,7 +299,7 @@ ClassMethod Commit(InternalName As %String, Message As %String = "example commit
299
299
do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Message , filename )
300
300
do ..PrintStreams (outStream , outStream )
301
301
$$$QuitOnError(##class (SourceControl.Git.Change ).RemoveUncommitted (filename ))
302
- $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted ())
302
+ $$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,, 1 ))
303
303
quit $$$OK
304
304
}
305
305
@@ -453,7 +453,7 @@ ClassMethod GenerateSSHKeyPair() As %Status
453
453
do ##class (%File ).CreateDirectoryChain (dir )
454
454
set outLog = ##class (%Library.File ).TempFilename ()
455
455
set errLog = ##class (%Library.File ).TempFilename ()
456
- do $zf (-100 ," /SHELL / STDOUT=" _$$$QUOTE(outLog )_" /STDERR=" _$$$QUOTE(errLog ),
456
+ do $zf (-100 ," /STDOUT=" _$$$QUOTE(outLog )_" /STDERR=" _$$$QUOTE(errLog ),
457
457
" ssh-keygen" ,
458
458
" -t" ," ed25519" ,
459
459
" -C" ,email ,
@@ -776,10 +776,13 @@ ClassMethod Type(InternalName As %String) As %String
776
776
} else {
777
777
set type =" csp"
778
778
}
779
+ if (type = " csp" ) {
780
+ quit type
781
+ }
779
782
}
780
783
781
784
// For an abstract document, use the GetOther() method to try to determine its "real" class
782
- If ##class ( %RoutineMgr ). UserType (InternalName ,.docclass ,.doctype ) {
785
+ If .. UserTypeCached (InternalName ,.docclass ,.doctype ) {
783
786
// Check for a real abstract document subclass (or GetOther() may not work)
784
787
If $classmethod (docclass ," %IsA" ," %Studio.AbstractDocument" ) && $classmethod (docclass ," %Extends" ," Ens.Util.AbstractDocument" ) {
785
788
// Grab the actual name
@@ -966,7 +969,7 @@ ClassMethod IsInSourceControl(InternalName As %String, ByRef sourceControlItem A
966
969
967
970
ClassMethod FullExternalName (ByRef InternalName As %String , ByRef MappingExists As %Boolean ) As %String [ CodeMode = expression ]
968
971
{
969
- ##class ( %File ). NormalizeFilename (.. TempFolder ()_..ExternalName (.InternalName , .MappingExists ) )
972
+ .. TempFolder ()_..ExternalName (.InternalName , .MappingExists )
970
973
}
971
974
972
975
ClassMethod NormalizeInternalName (ByRef name As %String ) As %String
@@ -1106,7 +1109,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
1106
1109
#dim sc as %Status = $$$OK
1107
1110
1108
1111
if ..IsRoutineOutdated (InternalName ) || force {
1109
- if ##class ( %RoutineMgr ). UserType (InternalName ,.docclass ,.doctype ) {
1112
+ if .. UserTypeCached (InternalName ,.docclass ,.doctype ) {
1110
1113
set routineMgr = ##class (%RoutineMgr ).%OpenId (InternalName )
1111
1114
do routineMgr .Code .Rewind ()
1112
1115
set source = ##class (%Stream.FileCharacter ).%OpenId (filename ,,.sc )
@@ -1169,7 +1172,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
1169
1172
set mappedFilePath = ##class (%File ).NormalizeFilename (mappedRelativePath , ..TempFolder ())
1170
1173
1171
1174
if (##class (%File ).DirectoryExists (mappedFilePath )){
1172
- if ##class ( %Library.RoutineMgr ). UserType (" foo." _mappingFileType ) {
1175
+ if .. UserTypeCached (" foo." _mappingFileType ) {
1173
1176
set fileSpec = " *." _$zcvt (mappingFileType ," L" )_" ;*." _$zconvert (mappingFileType ," U" )
1174
1177
set files = ##class (%Library.File ).FileSetFunc (mappedFilePath ,fileSpec )
1175
1178
while files .%Next () {
@@ -1268,7 +1271,7 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
1268
1271
if ##class (%File ).Exists (filename ) && '##class (%File ).Delete (filename ) {
1269
1272
set ec = $$$ADDSC(ec , ..MakeError (" Error while removing " _item ))
1270
1273
}
1271
- }elseif ##class ( %Library.RoutineMgr ). UserType (item ) {
1274
+ }elseif .. UserTypeCached (item ) {
1272
1275
set ec = $$$ADDSC(ec , ##class (%Library.RoutineMgr ).Delete (item ))
1273
1276
} else {
1274
1277
set deleted = 0
@@ -1485,8 +1488,20 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1485
1488
set errLog = ##class (%Library.File ).TempFilename ()
1486
1489
1487
1490
set command = $extract (..GitBinPath (),2 ,*-1 )
1488
- // Need /SHELL on Linux to avoid permissions errors trying to use root's config
1489
- set returnCode = $zf (-100 ," /SHELL /STDOUT=" _$$$QUOTE(outLog )_" /STDERR=" _$$$QUOTE(errLog )_$case (inFile , " " :" " , :" /STDIN=" _$$$QUOTE(inFile )),command ,newArgs ...)
1491
+ set baseArgs = " /STDOUT=" _$$$QUOTE(outLog )_" /STDERR=" _$$$QUOTE(errLog )_$case (inFile , " " :" " , :" /STDIN=" _$$$QUOTE(inFile ))
1492
+ try {
1493
+ // Inject instance manager directory as global git config home directory
1494
+ // On Linux, this avoids trying to use /root/.config/git/attributes for global git config
1495
+ set env (" XDG_CONFIG_HOME" ) = ##class (%File ).ManagerDirectory ()
1496
+ set returnCode = $zf (-100 ," /ENV=env... " _baseArgs ,command ,newArgs ...)
1497
+ } catch e {
1498
+ if $$$isWINDOWS {
1499
+ set returnCode = $zf (-100 ,baseArgs ,command ,newArgs ...)
1500
+ } else {
1501
+ // If can't inject XDG_CONFIG_HOME (older IRIS version), need /SHELL on Linux to avoid permissions errors trying to use root's config
1502
+ set returnCode = $zf (-100 ," /SHELL " _baseArgs ,command ,newArgs ...)
1503
+ }
1504
+ }
1490
1505
1491
1506
set errStream = ##class (%Stream.FileCharacter ).%OpenId (errLog ,,.sc )
1492
1507
set outStream = ##class (%Stream.FileCharacter ).%OpenId (outLog ,,.sc )
@@ -1538,10 +1553,10 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1538
1553
set relativePath = context .ResourceReference .Processor .OnItemRelativePath (InternalName )
1539
1554
quit relativePath
1540
1555
}
1541
- set usertype =$system .CLS .IsMthd (" %Library.RoutineMgr" ," UserType" )
1542
1556
1543
1557
// For an abstract document, use the GetOther() method to try to determine its "real" class
1544
- if usertype ,##class (%RoutineMgr ).UserType (InternalName ,.docclass ,.doctype ) {
1558
+ if ..UserTypeCached (InternalName ,.docclass ,.doctype ) {
1559
+ set usertype = 1
1545
1560
// Check for a real abstract document subclass (or GetOther() may not work)
1546
1561
if $classmethod (docclass ," %IsA" ," %Studio.AbstractDocument" ) && $classmethod (docclass ," %Extends" ," Ens.Util.AbstractDocument" ) {
1547
1562
// Grab the actual name
@@ -1552,9 +1567,11 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1552
1567
set InternalName = actualName
1553
1568
}
1554
1569
}
1570
+ } else {
1571
+ set usertype = 0
1555
1572
}
1556
1573
1557
- if '##class ( %Library.RoutineMgr ). UserType ( InternalName ) && $$CheckProtect ^%qccServer (InternalName ) {
1574
+ if 'usertype && $$CheckProtect ^%qccServer (InternalName ) {
1558
1575
quit " "
1559
1576
}
1560
1577
@@ -1631,7 +1648,7 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1631
1648
set InternalName =$extract (InternalName ,$length (p )+2 ,*)
1632
1649
quit $translate (found _$translate (InternalName ," %" ," _" )," \" ," /" )
1633
1650
1634
- } elseif ext =" CLS" ||(ext =" PRJ" )||( usertype &&( ##class ( %RoutineMgr ). UserType ( InternalName ))) {
1651
+ } elseif ext =" CLS" ||(ext =" PRJ" )||usertype {
1635
1652
set nam =$replace (nam ," %" , ..PercentClassReplace ())
1636
1653
if default {
1637
1654
set nam =$translate (nam ," ." ," /" )
@@ -1647,6 +1664,31 @@ ClassMethod Name(InternalName As %String, ByRef MappingExists As %Boolean) As %S
1647
1664
}
1648
1665
}
1649
1666
1667
+ /// Implementation copied from %Library.RoutineMgr, but with results cached in a PPG.
1668
+ ClassMethod UserTypeCached (Name As %String , ByRef Class As %String , ByRef StudioType As %String , ByRef Schema As %String , ByRef StudioIcon As %Integer ) As %Boolean
1669
+ {
1670
+ Set ext =$zconvert ($piece (Name ," ." ,*)," U" ) If ext =" " Quit 0
1671
+ If $Data (^||UserTypeCache (ext ," NotUserType" ))#2 {
1672
+ Quit 0
1673
+ }
1674
+ If $Data (^||UserTypeCache (ext ),data )#2 {
1675
+ Set Class = $Get (^||UserTypeCache (ext ," Class" ))
1676
+ Set StudioType =$list (data ),Schema =$listget (data ,3 ),StudioIcon =+$listget (data ,4 )
1677
+ Quit 1
1678
+ }
1679
+ Do StudioDocument ^%SYS .cspServer2 (.document )
1680
+ Set Class =" " ,StudioType =" " ,Schema =" "
1681
+ For Set Class =$order (document (Class )) Quit :Class =" " ||($data (document (Class ,ext ),data ))
1682
+ If Class =" " {
1683
+ Set ^||UserTypeCache (ext ," NotUserType" ) = 1
1684
+ Quit 0
1685
+ }
1686
+ Set StudioType =$list (data ),Schema =$listget (data ,3 ),StudioIcon =+$listget (data ,4 )
1687
+ Set ^||UserTypeCache (ext ) = data
1688
+ Set ^||UserTypeCache (ext ," Class" ) = Class
1689
+ Quit 1
1690
+ }
1691
+
1650
1692
/*
1651
1693
NameToInternalName(name): given a Unix-style slash path relative to repo root,
1652
1694
returns the internal name for that file (e.g., cls/SourceControl/Git/Utils.cls -> SourceControl.Git.Utils.CLS)
@@ -1658,21 +1700,16 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1, V
1658
1700
set context = ##class (SourceControl.Git.PackageManagerContext ).%Get ()
1659
1701
if (context .IsInGitEnabledPackage ) {
1660
1702
if ($zconvert (Name ," U" )'[$zconvert (context .Package .Root ," U" )) {
1661
- set Name = ##class ( %File ). NormalizeFilename ( context .Package .Root _Name )
1703
+ set Name = context .Package .Root _Name
1662
1704
}
1663
1705
} elseif ($zconvert (Name ," U" )'[$zconvert ($$$SourceRoot," U" )) {
1664
- set Name = ##class ( %File ). NormalizeFilename (.. TempFolder ()_Name )
1706
+ set Name = .. TempFolder ()_Name
1665
1707
}
1666
1708
if (##class (%File ).Exists (Name )) {
1667
- new %SourceControl //don't trigger source hooks with this test load to get the Name
1668
- set sc =$system .OBJ .Load (Name ," -d" ,,.outName ,1 )
1669
- if (($data (outName )=1 ) || ($data (outName ) = 11 && ($order (outName (" " ),-1 ) = $order (outName (" " ))))) && ($zconvert (..Type (outName )," U" ) '= " CSP" ) {
1670
- //only set if a single Name was returned ... ignore multi-item files
1671
- set InternalName =outName
1672
- if (context .IsInGitEnabledPackage ) {
1673
- // Don't need mappings!
1674
- return ..NormalizeInternalName (InternalName )
1675
- }
1709
+ set InternalName = ##class (SourceControl.Git.File ).ExternalNameToInternalName (Name )
1710
+ if (InternalName '= " " ) && (context .IsInGitEnabledPackage ) {
1711
+ // Don't need mappings!
1712
+ return ..NormalizeInternalName (InternalName )
1676
1713
}
1677
1714
} else {
1678
1715
// check for file in uncommitted queue
0 commit comments