Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of truncated class names from git pull #511

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed the back button navigation between WebUI and Settings page (#361)
- Basic mode Sync operation now imports items changed on the remote merge branch (#506)
- Fetch diff output uses correct remote branch (#509)
- Properly handle more cases of truncated filenames from git pull (#511)

## [2.5.0] - 2024-09-24

Expand Down
39 changes: 28 additions & 11 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1859,13 +1859,18 @@ ClassMethod SyncIrisWithRepoThroughCommand(ByRef outStream) As %Status
// In other cases, we'll just end up logging the invalid externalName.
if $Piece(externalName,".",*) = "cls" {
set possibleClasses = ..ExpandClasses(externalName)
set pointer = 0
while $ListNext(possibleClasses,pointer,class) {
set modification = ##class(SourceControl.Git.Modification).%New()
set modification.changeType = "C"
set modification.internalName = class_".CLS"
set modification.externalName = ..ExternalName(modification.internalName)
set files($i(files)) = modification
if $ListLength(possibleClasses) '= 0 {
set pointer = 0
while $ListNext(possibleClasses,pointer,class) {
set modification = ##class(SourceControl.Git.Modification).%New()
set modification.changeType = "C"
set modification.internalName = class_".CLS"
set modification.externalName = ..ExternalName(modification.internalName)
set files($i(files)) = modification
}
} else {
write !,"WARNING: unable to translate external name ",externalName
continue
}
} else {
write !,"WARNING: unable to translate external name ",externalName
Expand Down Expand Up @@ -1900,10 +1905,22 @@ ClassMethod ExpandClasses(externalName As %String) As %List
set internalName = $Piece(externalName,".",1,*-1)
set internalName = $Extract(internalName,4,*)
set internalName = $Translate(internalName,"/\%",".."_..PercentClassReplace())
&sql(select %DLIST(Name) into :classes from %Dictionary.ClassDefinition where Name like '%'||:internalName)
if (SQLCODE < 0) {
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
}
do {
&sql(select %DLIST(Name) into :classes from %Dictionary.ClassDefinition where Name like '%'||:internalName)
if (SQLCODE < 0) {
Throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,%msg)
}

// If nothing was found then remove period-delimited pieces from the start of internalName
// until we either find something or run out of pieces.
// This will allow for classes to potentially still be identified when the
// repository directory structure does not align with class packages.
if ($ListLength(classes) = 0) {
set internalName = $Piece(internalName,".",2,*)
} else {
set internalName = ""
}
} while (internalName '= "")
quit classes
}

Expand Down
Loading