@@ -74,9 +74,13 @@ Method AfterUserAction(Type As %Integer, Name As %String, InternalName As %Strin
7474 if menu '= " %SourceMenu" , menu '=" %SourceContext" {
7575 quit $$$OK
7676 }
77- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
77+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName , . fromWebApp )
7878 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
7979 set ec = ##class (SourceControl.Git.Utils ).AfterUserAction (Type , Name , InternalName , .Answer , .Msg , .Reload )
80+ if fromWebApp {
81+ // Force reload and compile of actual item if underlying file has changed
82+ do ..OnBeforeLoad (InternalName ,1 ,1 )
83+ }
8084 quit ec
8185}
8286
@@ -234,12 +238,12 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
234238
235239/// This is called before the actual load of data to give the chance
236240/// to load the item from an external format.
237- Method OnBeforeLoad (InternalName As %String , verbose As %Boolean ) As %Status
241+ Method OnBeforeLoad (InternalName As %String , verbose As %Boolean , compile As %Boolean = 0 ) As %Status
238242{
239243 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
240244 set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
241245 if ##class (SourceControl.Git.Utils ).IsInSourceControl (InternalName ) {
242- quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 )
246+ quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 , compile )
243247 }
244248 quit $$$OK
245249}
@@ -273,14 +277,21 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
273277{
274278 set sc = $$$OK
275279 try {
276- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName )
280+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName ,. fromWebApp ,. fullExternalName )
277281 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
278282 if ##class (SourceControl.Git.Utils ).IsNamespaceInGit () && ..IsInSourceControl (InternalName ) {
279- set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
280- $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
281- $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
282- if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
283- $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
283+ if fromWebApp {
284+ if fullExternalName = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName ) {
285+ // Reimport item into database
286+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,1 ,1 ))
287+ }
288+ } else {
289+ set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
290+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
291+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
292+ if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
293+ $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
294+ }
284295 }
285296 }
286297 } catch e {
0 commit comments