Skip to content

Commit a3fe580

Browse files
committed
Improved error handling; use studio open dialog query
1 parent 74816c2 commit a3fe580

File tree

1 file changed

+18
-39
lines changed

1 file changed

+18
-39
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,33 +2067,30 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
20672067
{
20682068
set sc = $$$OK
20692069
try {
2070-
write !, "Exporting classes..."
2071-
set sql = "SELECT ID FROM %Dictionary.ClassDefinition"
2072-
_ " WHERE GeneratedBy IS Null AND Deployed = 0"
2073-
_ " AND NOT ("
2074-
_ " ID %STARTSWITH 'csr.csp.' OR ID %STARTSWITH '%' OR ID %STARTSWITH 'CSPX.' OR ID %STARTSWITH 'Ens.'"
2075-
_ " OR ID %STARTSWITH 'EnsLib.' OR ID %STARTSWITH 'EnsPortal.'"
2076-
_ ")"
2077-
set rs = ##class(%SQL.Statement).%ExecDirect(,sql)
2070+
write !, "Exporting items..."
2071+
set rs = ##class(%Library.RoutineMgr).StudioOpenDialogFunc(
2072+
"*.mac,*.int,*.inc,*.cls,*.csp" // Spec
2073+
, , ,0 // SystemFiles
2074+
,1 // Flat
2075+
,0 // NotStudio
2076+
,0 // ShowGenerated
2077+
, , ,0 // Mapped
2078+
)
20782079
throw:rs.%SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(rs.%SQLCODE,rs.%Message)
2079-
while rs.%Next() {
2080-
set internalName = rs.ID _ ".CLS"
2080+
while rs.%Next(.sc) {
2081+
$$$ThrowOnError(sc)
2082+
set internalName = rs.Name
20812083
// exclude items in a non-default IPM package
20822084
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
20832085
continue:($isobject(context.Package) && 'context.IsInDefaultPackage)
2086+
// exclude CSPX classes
2087+
continue:(rs.Type=4)&&($match(internalName,"CSPX\..*"))
2088+
// exclude Ensemble system classes
2089+
continue:(rs.Type=4)&&($match(internalName,"Ens\..*")||$match(internalName,"EnsLib\..*")||$match(internalName,"EnsPortal\..*"))
2090+
// exclude Ensemble system MAC and INC routines
2091+
continue:((rs.Type=0)||(rs.Type=2))&&($extract(internalName,1,3)="Ens")
20842092
$$$ThrowOnError(..AddToSourceControl(internalName))
20852093
}
2086-
write !, "Exporting mac routines..."
2087-
do ..BaselineExportRoutines("*.MAC")
2088-
write !, "Exporting inc routines..."
2089-
do ..BaselineExportRoutines("*.INC")
2090-
/*
2091-
Other items may be supported in the future:
2092-
- DeepSee folder items
2093-
- Ensemble lookup tables
2094-
- Ensemble schema documents
2095-
- CSP applications
2096-
*/
20972094
if pCommitMessage '= "" {
20982095
// switch to default context
20992096
do ##class(SourceControl.Git.PackageManagerContext).ForInternalName("")
@@ -2115,22 +2112,4 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
21152112
return sc
21162113
}
21172114

2118-
ClassMethod BaselineExportRoutines(pFilter) [ Private ]
2119-
{
2120-
set rs = ##class(%Library.Routine).RoutineListFunc(pFilter)
2121-
throw:rs.%SQLCODE<0 ##class(%Exception.SQL).CreateFromSQLCODE(rs.%SQLCODE,rs.%Message)
2122-
while rs.%Next() {
2123-
continue:rs.Size=0
2124-
set item = rs.Name
2125-
// exclude items in a non-default IPM package
2126-
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(item)
2127-
continue:($isobject(context.Package) && 'context.IsInDefaultPackage)
2128-
// exclude generated routines from classes, SQL, etc.
2129-
continue:##class(%Library.RoutineMgr).IsGenerated(item)
2130-
// exclude Ens* routines
2131-
continue:($extract(item,1,3)="Ens")
2132-
$$$ThrowOnError(..AddToSourceControl(item))
2133-
}
2134-
}
2135-
21362115
}

0 commit comments

Comments
 (0)