Skip to content

Commit 7364173

Browse files
committed
fix: unrecognized files in Import All output warning instead of error
1 parent cbcdc5b commit 7364173

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Import All now imports configuration file before everything else (#806)
1717
- Fixed another instance of deletes showing as owned by undefined user (#812)
1818
- Fix Revert not syncing files with IRIS (#789)
19+
- Import All now outputs a warning instead of an error when an item is in the wrong path (#291)
1920

2021
## [2.12.2] - 2025-07-08
2122

cls/SourceControl/Git/Utils.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,7 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
15351535
}
15361536

15371537
if $get(err) > 0 {
1538-
write !, "There were some errors while importing files"
1538+
write !, "Warning: unrecognized files found in the sources directory:"
15391539
for i=1:1:err {
15401540
write !, err(i)
15411541
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Class UnitTest.SourceControl.Git.ImportAll Extends %UnitTest.TestCase
2+
{
3+
4+
Property InitialExtension As %String [ InitialExpression = {##class(%Studio.SourceControl.Interface).SourceControlClassGet()} ];
5+
6+
Property SourceControlGlobal [ MultiDimensional ];
7+
8+
Method %OnNew(initvalue) As %Status
9+
{
10+
Merge ..SourceControlGlobal = ^SYS("SourceControl")
11+
Kill ^SYS("SourceControl")
12+
Set settings = ##class(SourceControl.Git.Settings).%New()
13+
Set settings.namespaceTemp = ##class(%Library.File).TempFilename()_"dir"
14+
Set settings.Mappings("MAC","*")="rtn/"
15+
$$$ThrowOnError(settings.%Save())
16+
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet("SourceControl.Git.Extension")
17+
Quit ##super(initvalue)
18+
}
19+
20+
Method %OnClose() As %Status [ Private, ServerOnly = 1 ]
21+
{
22+
Do ##class(%Studio.SourceControl.Interface).SourceControlClassSet(..InitialExtension)
23+
Kill ^SYS("SourceControl")
24+
Merge ^SYS("SourceControl") = ..SourceControlGlobal
25+
Quit $$$OK
26+
}
27+
28+
Method TestImportAll()
29+
{
30+
do ..CreateTestRoutine()
31+
$$$ThrowOnError(##class(SourceControl.Git.Utils).AddToSourceControl("test.mac"))
32+
do ..CreateStrayFileInRtn()
33+
$$$ThrowOnError(##class(%Routine).Delete("test.mac"))
34+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ImportAll(1))
35+
do $$$AssertTrue(##class(%Routine).Exists("test.mac"))
36+
}
37+
38+
Method CreateTestRoutine()
39+
{
40+
if '##class(%Routine).Exists("test.mac") {
41+
set r = ##class(%Routine).%New("test.mac")
42+
do r.WriteLine(" write 22,!")
43+
do r.Save()
44+
do r.Compile()
45+
}
46+
}
47+
48+
/// creates a text file in the routines directory that is not really a routine
49+
Method CreateStrayFileInRtn()
50+
{
51+
set fileStream = ##class(%Stream.FileCharacter).%OpenId(
52+
##class(%File).NormalizeFilename(
53+
"test.txt",
54+
##class(%File).GetDirectory(##class(SourceControl.Git.Utils).FullExternalName("test.mac")))
55+
,,.sc)
56+
$$$ThrowOnError(sc)
57+
$$$ThrowOnError(fileStream.Write("hello world!"))
58+
$$$ThrowOnError(fileStream.%Save())
59+
}
60+
61+
}

0 commit comments

Comments
 (0)