Skip to content

Import items that don't already exist when compileOnImport is not set #799

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

Merged
merged 2 commits into from
Jul 10, 2025
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.13.0] - Unreleased

### Fixed
- Fix Import All not importing items that do not already exist when compileOnImport is not set (#798)

## [2.12.2] - 2025-07-08

### Fixed
Expand Down
31 changes: 19 additions & 12 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1578,20 +1578,27 @@ ClassMethod ImportRoutines(force As %Boolean = 0, pullEventClass As %String) As
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
continue:context.Package'=refPackage
set doImport = ..IsRoutineOutdated(internalName) || force
if ..IsInSourceControl(internalName) {
set sc = ..ImportItem(internalName, force)
} else {
if '..IsInSourceControl(internalName) {
set sc = ..AddToServerSideSourceControl(internalName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can run into an error here because sc is not defined if the very first file is not in source control:

<UNDEFINED>ImportRoutines+20^SourceControl.Git.Utils.1 *sc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I have updated the branch to address this.

if $$$ISERR(sc) {
set ec = $$$ADDSC(ec, sc)
}
}
if $$$ISERR(sc) {
set ec = $$$ADDSC(ec, sc)
}
if doImport && settings.compileOnImport {
set modification = ##class(SourceControl.Git.Modification).%New()
set modification.changeType = "M"
set modification.internalName = internalName
set modification.externalName = ..ExternalName(internalName)
set files($increment(files)) = modification
if doImport {
// If compiling then allow the pull event handler to import
if (settings.compileOnImport) {
set modification = ##class(SourceControl.Git.Modification).%New()
set modification.changeType = "M"
set modification.internalName = internalName
set modification.externalName = ..ExternalName(internalName)
set files($increment(files)) = modification
} else {
// If not compiling then import now as otherwise it won't happen
set sc = ..ImportItem(internalName, force)
if $$$ISERR(sc) {
set ec = $$$ADDSC(ec, sc)
}
}
}
}

Expand Down
Loading