Skip to content

Commit

Permalink
fixed issue #250 -- Set up default mappings with SourceControl.Git.Se…
Browse files Browse the repository at this point in the history
…ttings
  • Loading branch information
isc-rsaptars committed Sep 13, 2023
1 parent b9ac45d commit f0855e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cls/SourceControl/Git/API.cls
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ ClassMethod Configure()
write !,"Configured SourceControl.Git.Extension as source control class for namespace ",$namespace
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
if '$data(@mappingsNode) {
set @mappingsNode@("CLS","*")="cls/"
set @mappingsNode@("CLS","UnitTest")="test/"
set @mappingsNode@("INC","*")="inc/"
set @mappingsNode@("MAC","*")="rtn/"
do ##class(SourceControl.Git.Utils).SetDefaultMappings(mappingsNode)
write !,"Configured default mappings for classes, routines, and include files. You can customize these in the global:",!?5,mappingsNode
}
set gitExists = ##class(SourceControl.Git.Utils).GitBinExists(.version)
Expand Down
7 changes: 6 additions & 1 deletion cls/SourceControl/Git/Settings.cls
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ Property Mappings [ MultiDimensional ];

Method %OnNew() As %Status
{
merge ..Mappings = @##class(SourceControl.Git.Utils).MappingsNode()
set mappingsNode = ##class(SourceControl.Git.Utils).MappingsNode()
if '$data(@mappingsNode) {
do ##class(SourceControl.Git.Utils).SetDefaultMappings(mappingsNode)
}
merge ..Mappings = @mappingsNode
set gitBinPath = ##class(SourceControl.Git.Utils).GitBinPath(.isDefault)
if ('isDefault) {
set ..gitBinPath = gitBinPath
Expand Down Expand Up @@ -168,3 +172,4 @@ Method OnAfterConfigure() As %Boolean
}

}

11 changes: 10 additions & 1 deletion cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
set ec = ..AddToSourceControl(InternalName)
} elseif (menuItemName = "RemoveFromSC") {
set ec = ..RemoveFromSourceControl(InternalName)
} elseif (menuItemName = "Commit") {
} // is there any reason this code block is repeated?
elseif (menuItemName = "Commit") {
set Target = "Please enter a commit message"
set Action = 7
quit $$$OK
Expand Down Expand Up @@ -1986,5 +1987,13 @@ ClassMethod BuildCEInstallationPackage(ByRef destination As %String) As %Status
quit sc
}

ClassMethod SetDefaultMappings(mappingsNode As %String)
{
set @mappingsNode@("CLS","*")="cls/"
set @mappingsNode@("CLS","UnitTest")="test/"
set @mappingsNode@("INC","*")="inc/"
set @mappingsNode@("MAC","*")="rtn/"
}

}

0 comments on commit f0855e8

Please sign in to comment.