Skip to content

Commit 098a708

Browse files
committed
fix: production items are exported for source control when production is not in source control
required now that production class is not a separate source controlled item
1 parent 7b010c5 commit 098a708

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

cls/SourceControl/Git/Extension.cls

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
276276
try {
277277
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(.InternalName)
278278
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(InternalName)
279-
if ##class(SourceControl.Git.Utils).IsNamespaceInGit() && ..IsInSourceControl(InternalName) {
279+
if ##class(SourceControl.Git.Utils).IsNamespaceInGit() {
280280
// If this is a production class and production decomposition is enabled, call recursively on all modified production items.
281281
if ##class(SourceControl.Git.Utils).ItemIsProductionToDecompose(InternalName) {
282282
do ##class(SourceControl.Git.Production).GetModifiedItemsAfterSave(InternalName, .productionItems)
@@ -296,11 +296,13 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
296296
set key = $order(productionItems(key))
297297
}
298298
}
299-
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
300-
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
301-
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
302-
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
303-
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
299+
if ..IsInSourceControl(InternalName) {
300+
set filename = ##class(SourceControl.Git.Utils).FullExternalName(InternalName)
301+
$$$ThrowOnError(##class(SourceControl.Git.Utils).RemoveRoutineTSH(InternalName))
302+
$$$ThrowOnError(##class(SourceControl.Git.Utils).ExportItem(InternalName))
303+
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
304+
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "edit", InternalName, $username, "", 1, "", "", 0))
305+
}
304306
}
305307
}
306308
} catch e {

cls/SourceControl/Git/Utils.cls

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,18 +1534,21 @@ ClassMethod ExportItem(InternalName As %String, expand As %Boolean = 1, force As
15341534
write "Mapping to another database found. Skipping export"
15351535
quit $$$OK
15361536
}
1537-
set filenames($I(filenames)) = filename
15381537
write !, "exporting new version of ", InternalName, " to ", filename
15391538
if (type = "ptd") {
15401539
$$$QuitOnError(##class(SourceControl.Git.Production).ExportPTD(InternalName,"FullExternalName"))
15411540
} elseif (..ItemIsProductionToDecompose(InternalName, .productionName)) {
15421541
write !, "Production decomposition enabled, skipping export of production class"
1542+
set filename = ""
15431543
} else {
15441544
$$$QuitOnError($system.OBJ.ExportUDL(InternalName, filename,"-d/diff"))
15451545
}
1546-
$$$QuitOnError(..UpdateRoutineTSH(InternalName, $h))
1547-
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
1548-
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "add", InternalName, $username, "", 1, "", "", 0))
1546+
if (filename '= "") {
1547+
set filenames($I(filenames)) = filename
1548+
$$$QuitOnError(..UpdateRoutineTSH(InternalName, $h))
1549+
if '##class(SourceControl.Git.Change).IsUncommitted(filename) {
1550+
$$$ThrowOnError(##class(SourceControl.Git.Change).SetUncommitted(filename, "add", InternalName, $username, "", 1, "", "", 0))
1551+
}
15491552
}
15501553
}
15511554
}

0 commit comments

Comments
 (0)