Skip to content

Import All outputs warning instead of error if unrecognized files found #826

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 1 commit into from
Aug 6, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Import All now imports configuration file before everything else (#806)
- Fixed another instance of deletes showing as owned by undefined user (#812)
- Fix Revert not syncing files with IRIS (#789)
- Import All now outputs a warning instead of an error when an item is in the wrong path (#291)

## [2.12.2] - 2025-07-08

Expand Down
2 changes: 1 addition & 1 deletion cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
}

if $get(err) > 0 {
write !, "There were some errors while importing files"
write !, "Warning: unrecognized files found in the sources directory:"
for i=1:1:err {
write !, err(i)
}
Expand Down
61 changes: 61 additions & 0 deletions test/UnitTest/SourceControl/Git/ImportAll.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Class UnitTest.SourceControl.Git.ImportAll Extends %UnitTest.TestCase
{

Property InitialExtension As %String [ InitialExpression = {##class(%Studio.SourceControl.Interface).SourceControlClassGet()} ];

Property SourceControlGlobal [ MultiDimensional ];

Method %OnNew(initvalue) As %Status
{
Merge ..SourceControlGlobal = ^SYS("SourceControl")
Kill ^SYS("SourceControl")
Set settings = ##class(SourceControl.Git.Settings).%New()
Set settings.namespaceTemp = ##class(%Library.File).TempFilename()_"dir"
Set settings.Mappings("MAC","*")="rtn/"
$$$ThrowOnError(settings.%Save())
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension")
Quit ##super(initvalue)
}

Method %OnClose() As %Status [ Private, ServerOnly = 1 ]
{
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet(..InitialExtension)
Kill ^SYS("SourceControl")
Merge ^SYS("SourceControl") = ..SourceControlGlobal
Quit $$$OK
}

Method TestImportAll()
{
do ..CreateTestRoutine()
$$$ThrowOnError(##class(SourceControl.Git.Utils).AddToSourceControl("test.mac"))
do ..CreateStrayFileInRtn()
$$$ThrowOnError(##class(%Routine).Delete("test.mac"))
$$$ThrowOnError(##class(SourceControl.Git.Utils).ImportAll(1))
do $$$AssertTrue(##class(%Routine).Exists("test.mac"))
}

Method CreateTestRoutine()
{
if '##class(%Routine).Exists("test.mac") {
set r = ##class(%Routine).%New("test.mac")
do r.WriteLine(" write 22,!")
do r.Save()
do r.Compile()
}
}

/// creates a text file in the routines directory that is not really a routine
Method CreateStrayFileInRtn()
{
set fileStream = ##class(%Stream.FileCharacter).%OpenId(
##class(%File).NormalizeFilename(
"test.txt",
##class(%File).GetDirectory(##class(SourceControl.Git.Utils).FullExternalName("test.mac")))
,,.sc)
$$$ThrowOnError(sc)
$$$ThrowOnError(fileStream.Write("hello world!"))
$$$ThrowOnError(fileStream.%Save())
}

}
Loading