@@ -1860,13 +1860,18 @@ ClassMethod SyncIrisWithRepoThroughCommand(ByRef outStream) As %Status
1860
1860
// In other cases, we'll just end up logging the invalid externalName.
1861
1861
if $Piece (externalName ," ." ,*) = " cls" {
1862
1862
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
1870
1875
}
1871
1876
} else {
1872
1877
write !," WARNING: unable to translate external name " ,externalName
@@ -1901,10 +1906,22 @@ ClassMethod ExpandClasses(externalName As %String) As %List
1901
1906
set internalName = $Piece (externalName ," ." ,1 ,*-1 )
1902
1907
set internalName = $Extract (internalName ,4 ,*)
1903
1908
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 '= " " )
1908
1925
quit classes
1909
1926
}
1910
1927
0 commit comments