@@ -2,6 +2,19 @@ Include %syPrompt
22
33IncludeGenerator  %syPrompt 
44
5+ /// Public API for configuring Embedded Git settings. Settings may be configured: 
6+ /// <ul> 
7+ /// <li>Interactively in terminal by running do ##class(SourceControl.Git.API).Configure()</li> 
8+ /// <li>In the Settings page accessed through the source control menu</li> 
9+ /// <li>Through a configuration file embedded-git-config.json</li> 
10+ /// <li>Programmatically by creating an instance of this object.</li> 
11+ /// </ul> 
12+ /// For an example of the last, see below: 
13+ /// <pre> 
14+ /// set settings = ##class(SourceControl.Git.Settings).%New() 
15+ /// set settings.mappedItemsReadOnly = 1 
16+ /// $$$ThrowOnError(settings.%Save()) 
17+ /// </pre> 
518Class  SourceControl .Git .Settings  Extends  %RegisteredObject 
619{
720
@@ -68,8 +81,16 @@ Property lockBranch As %Boolean [ InitialExpression = {##class(SourceControl.Git
6881/// (Optional) A namespace-specific string that may be included in mapping configurations as <token> to support multi-namespace repositories 
6982Property  mappingsToken  As  %String (MAXLEN  = " " InitialExpression  = {##class (SourceControl.Git.Utils ).MappingsToken ()} ]; 
7083
84+ /// A multi-dimensional array that maps item types to directories in the source repository, structured as follows: 
85+ /// settings.Mappings("<item type>","<filter>") = "<folder>" 
86+ /// settings.Mappings("<item type>","<filter>","NoFolders") = 1 
87+ /// - item type: file extension to use, e.g., CLS, MAC. As a special case for web application files, use "/CSP/". 
88+ /// - filter: a filter on files of that type, e.g. * for all, or a package name or web application folder 
89+ /// - folder: folder relative to the repo root that contains the item 
90+ /// - NoFolders: if the value of this node is false, dots in the item name will be expanded to subdirectories. e.g. /cls/PackageName/ClassName.cls 
7191Property  Mappings  [ MultiDimensional  ]; 
7292
93+ /// (user-level) List of namespaces on this instance to include Embedded Git links in the SMP favorites 
7394Property  favoriteNamespaces  As  %DynamicArray ; 
7495
7596Method  %OnNew () As  %Status 
@@ -87,6 +108,7 @@ Method %OnNew() As %Status
87108    quit  $$$OK
88109}
89110
111+ /// Saves namespace settings to a configuration file and adds it to the source control repository. 
90112Method  SaveWithSourceControl () As  %Status 
91113{
92114    set  sc  = $$$OK
@@ -191,7 +213,7 @@ Method %Save() As %Status
191213    quit  $$$OK
192214}
193215
194- Method  ToDynamicObject () As  %DynamicObject 
216+ Method  ToDynamicObject () As  %DynamicObject  [  Internal  ] 
195217{
196218    // uses custom methods rather than %JSON.Adaptor because Mappings multidimensional 
197219    // array is not supported 
@@ -217,7 +239,7 @@ Method ToDynamicObject() As %DynamicObject
217239    return  settingsJSON 
218240}
219241
220- Method  ImportDynamicObject (pSettingsDyn  As  %DynamicObject )
242+ Method  ImportDynamicObject (pSettingsDyn  As  %DynamicObject ) [  Internal  ] 
221243{
222244    set  ..pullEventClass  = pSettingsDyn .%Get (" pullEventClass" 
223245    set  ..percentClassReplace  = pSettingsDyn .%Get (" percentClassReplace" 
@@ -238,7 +260,7 @@ Method ImportDynamicObject(pSettingsDyn As %DynamicObject)
238260    }
239261}
240262
241- ClassMethod  CreateNamespaceTempFolder () As  %Status 
263+ ClassMethod  CreateNamespaceTempFolder () As  %Status  [  Internal  ] 
242264{
243265    set  storage  = ##class (SourceControl.Git.Utils ).#Storage
244266    if  ('##class (%File ).DirectoryExists (@storage @(" settings" " namespaceTemp" 
@@ -248,7 +270,7 @@ ClassMethod CreateNamespaceTempFolder() As %Status
248270    return  $$$OK
249271}
250272
251- ClassMethod  Configure () As  %Boolean  [ CodeMode  = objectgenerator  ]
273+ ClassMethod  Configure () As  %Boolean  [ CodeMode  = objectgenerator ,  Internal  ]
252274{
253275    do  %code .WriteLine ("  set inst = ..%New()" 
254276    do  %code .WriteLine ("  do inst.RetrieveDefaults()" 
@@ -321,7 +343,7 @@ ClassMethod Configure() As %Boolean [ CodeMode = objectgenerator ]
321343    do  %code .WriteLine ("  quit 1" 
322344}
323345
324- Method  ConfigureNamespaceWebApplication ()
346+ Method  ConfigureNamespaceWebApplication () [  Internal  ] 
325347{
326348    Set  root  = ##class (%Library.File ).NormalizeDirectory (##class (SourceControl.Git.Utils ).TempFolder ())
327349    Set  deleteWebApp  = ..HasNamespaceWebApp (.appDirectory ) && '..namespaceLevelGitWebApp 
@@ -381,7 +403,7 @@ Method WebAppOperation(name, create As %Boolean, delete As %Boolean, root As %St
381403    }
382404}
383405
384- ClassMethod  HasNamespaceWebApp (Output  webAppDirectory ) As  %Boolean 
406+ ClassMethod  HasNamespaceWebApp (Output  webAppDirectory ) As  %Boolean  [  Internal  ] 
385407{
386408    Set  webAppDirectory  = $System .CSP .GetFileName (" /git/" $Namespace _" /" 
387409    If  (webAppDirectory  '= " " 
@@ -390,7 +412,7 @@ ClassMethod HasNamespaceWebApp(Output webAppDirectory) As %Boolean
390412    Quit  (webAppDirectory  '= " " 
391413}
392414
393- Method  OnAfterConfigure () As  %Boolean 
415+ Method  OnAfterConfigure () As  %Boolean  [  Internal  ] 
394416{
395417    set  defaultPromptFlag  = $$$DisableBackupCharMask + $$$TrapCtrlCMask + $$$EnableQuitCharMask + $$$DisableHelpCharMask + $$$DisableHelpContextCharMask + $$$TrapErrorMask
396418    if  (..privateKeyFile  '= " " ##class (%File ).Exists (..privateKeyFile ) {
@@ -474,7 +496,7 @@ Method OnAfterConfigure() As %Boolean
474496    }
475497}
476498
477- Method  ConfigureBinPath (ByRef  path  As  %String ) As  %Boolean 
499+ Method  ConfigureBinPath (ByRef  path  As  %String ) As  %Boolean  [  Internal  ] 
478500{
479501    if  (path  = " " return  1  }
480502    // Sometimes path is quoted  
@@ -506,7 +528,7 @@ Method ConfigureBinPath(ByRef path As %String) As %Boolean
506528    return  1 
507529}
508530
509- Method  RetrieveDefaults () As  %Boolean 
531+ Method  RetrieveDefaults () As  %Boolean  [  Internal  ] 
510532{
511533    do  ##class (%zpkg.isc.sc.git.Defaults ).GetDefaultSettings (.settings )
512534    set  iterator  = settings .%GetIterator ()
@@ -516,6 +538,7 @@ Method RetrieveDefaults() As %Boolean
516538    return  $$$OK
517539}
518540
541+ /// Saves certain settings as default settings for the instance. Instance defaults are overwritten by namespace-level settings. 
519542Method  SaveDefaults () As  %Boolean 
520543{
521544    set  defaults  = {}
0 commit comments