Skip to content

Commit 55d0986

Browse files
committed
import all now imports user types in subdirectories recursively
1 parent 7bf670f commit 55d0986

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,24 @@ ClassMethod ImportCSPFile(InternalName As %String) As %Status
13161316
Quit sc
13171317
}
13181318

1319+
ClassMethod ListItemsRecursively(type, fileSpec, directory, ByRef itemList) [ Private ]
1320+
{
1321+
set files = ##class(%Library.File).FileSetFunc(directory,fileSpec,,1)
1322+
throw:files.%SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(files.%SQLCODE,files.%Message)
1323+
while files.%Next() {
1324+
if (files.Type="D") {
1325+
do ..ListItemsRecursively(type, fileSpec, files.Name, .itemList)
1326+
} else {
1327+
set internalName = files.ItemName
1328+
if ($zconvert(type,"l") = "ptd") && $$$comClassDefined("%Studio.SourceControl.Production") {
1329+
do ##class(%Studio.SourceControl.Production).ParseExternalName($translate(files.Name,"\","/"), .internalName)
1330+
}
1331+
set itemList(internalName) = ""
1332+
}
1333+
}
1334+
}
1335+
1336+
/// Returns an array of internal names of all items in the local source control repository.
13191337
ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
13201338
{
13211339
#define DoNotLoad 1
@@ -1332,13 +1350,11 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
13321350
set mappedFilePath = ##class(%File).NormalizeFilename(mappedRelativePath, ..TempFolder())
13331351

13341352
if (##class(%File).DirectoryExists(mappedFilePath)){
1335-
if ..UserTypeCached("foo."_mappingFileType) {
1336-
set fileSpec = "*."_$zcvt(mappingFileType,"L")_";*."_$zconvert(mappingFileType,"U")
1337-
set files = ##class(%Library.File).FileSetFunc(mappedFilePath,fileSpec)
1338-
while files.%Next() {
1339-
// Assumes flat file structure
1340-
set itemList(files.ItemName) = ""
1341-
}
1353+
if ..UserTypeCached("foo."_mappingFileType, .userTypeClass) {
1354+
set fileSpec = $select(
1355+
userTypeClass="Ens.Util.ProjectTextDocument": "*.xml;*.XML",
1356+
1: "*."_$zcvt(mappingFileType,"L")_";*."_$zconvert(mappingFileType,"U"))
1357+
do ..ListItemsRecursively(mappingFileType, fileSpec, mappedFilePath, .itemList)
13421358
} else {
13431359
set res = $system.OBJ.ImportDir(mappedFilePath,,"-d",.err,1, .tempItemList, $$$DoNotLoad)
13441360
merge itemList = tempItemList

0 commit comments

Comments
 (0)