Skip to content

Commit f0855e8

Browse files
committed
fixed issue #250 -- Set up default mappings with SourceControl.Git.Settings
1 parent b9ac45d commit f0855e8

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

cls/SourceControl/Git/API.cls

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ ClassMethod Configure()
1212
write !,"Configured SourceControl.Git.Extension as source control class for namespace ",$namespace
1313
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
1414
if '$data(@mappingsNode) {
15-
set @mappingsNode@("CLS","*")="cls/"
16-
set @mappingsNode@("CLS","UnitTest")="test/"
17-
set @mappingsNode@("INC","*")="inc/"
18-
set @mappingsNode@("MAC","*")="rtn/"
15+
do ##class(SourceControl.Git.Utils).SetDefaultMappings(mappingsNode)
1916
write !,"Configured default mappings for classes, routines, and include files. You can customize these in the global:",!?5,mappingsNode
2017
}
2118
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)

cls/SourceControl/Git/Settings.cls

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ Property Mappings [ MultiDimensional ];
3030

3131
Method %OnNew() As %Status
3232
{
33-
merge ..Mappings = @##class(SourceControl.Git.Utils).MappingsNode()
33+
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
34+
if '$data(@mappingsNode) {
35+
do ##class(SourceControl.Git.Utils).SetDefaultMappings(mappingsNode)
36+
}
37+
merge ..Mappings = @mappingsNode
3438
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)
3539
if ('isDefault) {
3640
set ..gitBinPath = gitBinPath
@@ -168,3 +172,4 @@ Method OnAfterConfigure() As %Boolean
168172
}
169173

170174
}
175+

cls/SourceControl/Git/Utils.cls

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
233233
set ec = ..AddToSourceControl(InternalName)
234234
} elseif (menuItemName = "RemoveFromSC") {
235235
set ec = ..RemoveFromSourceControl(InternalName)
236-
} elseif (menuItemName = "Commit") {
236+
} // is there any reason this code block is repeated?
237+
elseif (menuItemName = "Commit") {
237238
set Target = "Please enter a commit message"
238239
set Action = 7
239240
quit $$$OK
@@ -1986,5 +1987,13 @@ ClassMethod BuildCEInstallationPackage(ByRef destination As %String) As %Status
19861987
quit sc
19871988
}
19881989

1990+
ClassMethod SetDefaultMappings(mappingsNode As %String)
1991+
{
1992+
set @mappingsNode@("CLS","*")="cls/"
1993+
set @mappingsNode@("CLS","UnitTest")="test/"
1994+
set @mappingsNode@("INC","*")="inc/"
1995+
set @mappingsNode@("MAC","*")="rtn/"
1996+
}
1997+
19891998
}
19901999

0 commit comments

Comments
 (0)