@@ -91,9 +91,13 @@ Method AfterUserAction(Type As %Integer, Name As %String, InternalName As %Strin
91
91
if menu '= " %SourceMenu" , menu '=" %SourceContext" {
92
92
quit $$$OK
93
93
}
94
- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
94
+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName , . fromWebApp )
95
95
set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
96
96
set ec = ##class (SourceControl.Git.Utils ).AfterUserAction (Type , Name , InternalName , .Answer , .Msg , .Reload )
97
+ if fromWebApp {
98
+ // Force reload and compile of actual item if underlying file has changed
99
+ do ..OnBeforeLoad (InternalName ,1 ,1 )
100
+ }
97
101
quit ec
98
102
}
99
103
@@ -142,6 +146,7 @@ Method OnSourceMenuItem(name As %String, ByRef Enabled As %String, ByRef Display
142
146
" Status" : 1 ,
143
147
" GitWebUI" : 1 ,
144
148
" NewBranch" : 1 ,
149
+ " SwitchBranch" : 1 ,
145
150
" Sync" : 1 ,
146
151
" " : 1 ,
147
152
:-1
@@ -251,12 +256,12 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
251
256
252
257
/// This is called before the actual load of data to give the chance
253
258
/// to load the item from an external format.
254
- Method OnBeforeLoad (InternalName As %String , verbose As %Boolean ) As %Status
259
+ Method OnBeforeLoad (InternalName As %String , verbose As %Boolean , compile As %Boolean = 0 ) As %Status
255
260
{
256
261
set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
257
262
set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
258
263
if ##class (SourceControl.Git.Utils ).IsInSourceControl (InternalName ) {
259
- quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 )
264
+ quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 , compile )
260
265
}
261
266
quit $$$OK
262
267
}
@@ -290,14 +295,21 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
290
295
{
291
296
set sc = $$$OK
292
297
try {
293
- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName )
298
+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName ,. fromWebApp ,. fullExternalName )
294
299
set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
295
300
if ##class (SourceControl.Git.Utils ).IsNamespaceInGit () && ..IsInSourceControl (InternalName ) {
296
- set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
297
- $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
298
- $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
299
- if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
300
- $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
301
+ if fromWebApp {
302
+ if fullExternalName = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName ) {
303
+ // Reimport item into database
304
+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,1 ,1 ))
305
+ }
306
+ } else {
307
+ set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
308
+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
309
+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
310
+ if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
311
+ $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
312
+ }
301
313
}
302
314
}
303
315
} catch e {
0 commit comments