@@ -1860,13 +1860,18 @@ ClassMethod SyncIrisWithRepoThroughCommand(ByRef outStream) As %Status
18601860 // In other cases, we'll just end up logging the invalid externalName.
18611861 if $Piece (externalName ," ." ,*) = " cls" {
18621862 set possibleClasses = ..ExpandClasses (externalName )
1863- set pointer = 0
1864- while $ListNext (possibleClasses ,pointer ,class ) {
1865- set modification = ##class (SourceControl.Git.Modification ).%New ()
1866- set modification .changeType = " C"
1867- set modification .internalName = class _" .CLS"
1868- set modification .externalName = ..ExternalName (modification .internalName )
1869- set files ($i (files )) = modification
1863+ if $ListLength (possibleClasses ) '= 0 {
1864+ set pointer = 0
1865+ while $ListNext (possibleClasses ,pointer ,class ) {
1866+ set modification = ##class (SourceControl.Git.Modification ).%New ()
1867+ set modification .changeType = " C"
1868+ set modification .internalName = class _" .CLS"
1869+ set modification .externalName = ..ExternalName (modification .internalName )
1870+ set files ($i (files )) = modification
1871+ }
1872+ } else {
1873+ write !," WARNING: unable to translate external name " ,externalName
1874+ continue
18701875 }
18711876 } else {
18721877 write !," WARNING: unable to translate external name " ,externalName
@@ -1901,10 +1906,22 @@ ClassMethod ExpandClasses(externalName As %String) As %List
19011906 set internalName = $Piece (externalName ," ." ,1 ,*-1 )
19021907 set internalName = $Extract (internalName ,4 ,*)
19031908 set internalName = $Translate (internalName ," /\%" ," .." _..PercentClassReplace ())
1904- &sql (select %DLIST(Name) into :classes from %Dictionary .ClassDefinition where Name like '%'||:internalName )
1905- if (SQLCODE < 0 ) {
1906- Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
1907- }
1909+ do {
1910+ &sql (select %DLIST(Name) into :classes from %Dictionary .ClassDefinition where Name like '%'||:internalName )
1911+ if (SQLCODE < 0 ) {
1912+ Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
1913+ }
1914+
1915+ // If nothing was found then remove period-delimited pieces from the start of internalName
1916+ // until we either find something or run out of pieces.
1917+ // This will allow for classes to potentially still be identified when the
1918+ // repository directory structure does not align with class packages.
1919+ if ($ListLength (classes ) = 0 ) {
1920+ set internalName = $Piece (internalName ," ." ,2 ,*)
1921+ } else {
1922+ set internalName = " "
1923+ }
1924+ } while (internalName '= " " )
19081925 quit classes
19091926}
19101927
0 commit comments