Skip to content

Commit 9d65a6e

Browse files
authored
Merge pull request #57 from intersystems/onbeforetimestamp
Implement OnBeforeTimestamp in extension
2 parents a3b1120 + edd0ad9 commit 9d65a6e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cls/SourceControl/Git/Extension.cls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,22 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
183183

184184
/// This is called before the actual load of data to give the chance
185185
/// to load the item from an external format.
186-
Method OnBeforeLoad(InternalName As %String) As %Status
186+
Method OnBeforeLoad(InternalName As %String, verbose As %Boolean) As %Status
187187
{
188188
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
189189
set InternalName = ##class(Utils).NormalizeInternalName(InternalName)
190190
if ##class(Utils).IsInSourceControl(InternalName) {
191-
quit ##class(Utils).ImportItem(InternalName)
191+
quit ##class(Utils).ImportItem(InternalName,,0)
192192
}
193193
quit $$$OK
194194
}
195195

196+
/// Called before Studio checks for the timestamp of an item.
197+
Method OnBeforeTimestamp(InternalName As %String)
198+
{
199+
quit ..OnBeforeLoad(InternalName,0)
200+
}
201+
196202
/// This is called after the item has been saved to the database.
197203
/// It may be passed a reference to the object representing the item
198204
/// just saved. It can be use to export this documement to an external form for example.

cls/SourceControl/Git/Utils.cls

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,10 +804,8 @@ ClassMethod FixProjectCspReferences(projectName As %String) As %Status
804804

805805
/// imports file if version in system is newer then version on disk.
806806
/// if <var>force</var> = 1 then imports in any case.
807-
ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0) As %Status
807+
ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose As %Boolean = 1) As %Status
808808
{
809-
//WRITE "Before Load Of: ", InternalName, " ", ..IsInSourceControl(InternalName), !
810-
//q:'..IsInSourceControl(InternalName) $$$OK
811809
#dim filename As %String = ..FullExternalName(InternalName)
812810
#dim fileTSH = ##class(%File).GetFileDateModified(filename)
813811
#dim sc As %Status = $$$OK
@@ -824,7 +822,7 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0) As %Statu
824822
write "ERROR importing" ,InternalName,!
825823
do $system.Status.DisplayError(sc)
826824
}
827-
} else {
825+
} elseif verbose {
828826
write InternalName, " is the same as on-disk version or newer, skipping import",!
829827
}
830828
Quit sc

0 commit comments

Comments
 (0)