Skip to content

Commit 7484851

Browse files
authored
Removing from source control now works (#80)
* Removing from source control now works * Call git rm for individual files as well * Replaced custom function with library function Co-authored-by: Sarmishta Velury <[email protected]>
1 parent 704b944 commit 7484851

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ ClassMethod AddToSourceControl(InternalName As %String) As %Status
402402
quit ec
403403
}
404404

405+
ClassMethod RemoveFromGit(InternalName)
406+
{
407+
#dim fullName = ##class(Utils).FullExternalName(InternalName)
408+
do ..RunGitCommand("rm",.errStream,.outStream,"--cached", fullName)
409+
do errStream.OutputToDevice()
410+
}
411+
405412
ClassMethod DeleteExternalsForItem(InternalName As %String) As %Status
406413
{
407414
#dim type as %String = ..Type(InternalName)
@@ -425,16 +432,19 @@ ClassMethod DeleteExternalsForItem(InternalName As %String) As %Status
425432
if 'sc {
426433
set ec = $$$ADDSC(ec, sc)
427434
}
435+
do ..RemoveFromGit(item)
428436
}
429437
}
430438
} else {
431439
set ec = ..DeleteExternalFile(InternalName)
440+
do ..RemoveFromGit(InternalName)
432441
}
433442
quit ec
434443
}
435444

436445
ClassMethod RemoveFromSourceControl(InternalName As %String) As %Status
437446
{
447+
write !
438448
#dim sc as %Status = $$$OK
439449
for i = 1:1:$length(InternalName, ",") {
440450
#dim tsc as %Status = $$$OK
@@ -828,8 +838,28 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
828838
ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
829839
{
830840
#define DoNotLoad 1
831-
set res = $system.OBJ.ImportDir(..TempFolder(),"*.xml","-d",.err,1, .itemList, $$$DoNotLoad)
832841

842+
set mappingFileType = $order($$$SourceMapping(""))
843+
while (mappingFileType '= "") {
844+
845+
set mappingCoverage = $order($$$SourceMapping(mappingFileType, ""))
846+
847+
while (mappingCoverage '= ""){
848+
849+
set mappedRelativePath = $$$SourceMapping(mappingFileType, mappingCoverage)
850+
set mappedFilePath = ##class(%File).NormalizeFilename(mappedRelativePath, ..TempFolder())
851+
852+
if (##class(%File).DirectoryExists(mappedFilePath)){
853+
set res = $system.OBJ.ImportDir(mappedFilePath,,"-d",.err,1, .tempItemList, $$$DoNotLoad)
854+
merge itemList = tempItemList
855+
}
856+
857+
set mappingCoverage = $order($$$SourceMapping(mappingFileType, mappingCoverage))
858+
}
859+
860+
set mappingFileType = $order($$$SourceMapping(mappingFileType))
861+
}
862+
833863
if '$data(itemList) && $$$ISERR(res) {
834864
quit res
835865
}

0 commit comments

Comments
 (0)