Skip to content

Commit f5eecdc

Browse files
committed
Fixes for Import/Export All
Might make sense to consolidate "items" and "TSH" - not clear to me what the distinction is and feels like a duplicate subscript
1 parent b0560f6 commit f5eecdc

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [2.0.6] - 2022-12-06
8+
## [2.0.6] - Unreleased
99

1010
### Added
1111
- Support for Caché/Ensemble 2016.2.3, 2017.1.2, 2017.2.1, 2018.1.0 and later. (Treated as patch version bump because no compatibility impact for existing users.)
1212

13+
### Fixed
14+
- "Import All" will properly recognize new files
15+
- "Import All" and "Export All" apply only to the current package manager context and disregard items outside that context
16+
1317
### Changed
1418
- Various minor things under the hood to support use without the package manager and/or on older platforms
1519

cls/SourceControl/Git/PackageManagerContext.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Property ResourceReference As %RegisteredObject [ InitialExpression = {$$$NULLOR
1616

1717
Method InternalNameSet(InternalName As %String = "") As %Status
1818
{
19+
set InternalName = ##class(SourceControl.Git.Utils).NormalizeInternalName(InternalName)
1920
if (InternalName '= i%InternalName) {
2021
set i%InternalName = InternalName
2122
if '$$$comClassDefined("%ZPM.PackageManager.Developer.Extension.Utils") {
@@ -24,7 +25,7 @@ Method InternalNameSet(InternalName As %String = "") As %Status
2425
set ..Package = ##class(%ZPM.PackageManager.Developer.Extension.Utils).FindHomeModule(InternalName,,.resourceReference)
2526
set ..ResourceReference = resourceReference
2627
set ..IsInGitEnabledPackage = $isobject(..Package) && ##class(%Library.File).DirectoryExists(##class(%Library.File).NormalizeFilename(".git",..Package.Root))
27-
set ..IsInDefaultPackage = $isobject(..Package) && (##class(%Library.File).NormalizeDirectory(..Package.Root) = ##class(%Library.File).NormalizeDirectory(##class(SourceControl.Git.Utils).TempFolder()))
28+
set ..IsInDefaultPackage = $isobject(..Package) && (##class(%Library.File).NormalizeDirectory(..Package.Root) = ##class(%Library.File).NormalizeDirectory(##class(SourceControl.Git.Utils).DefaultTempFolder()))
2829
}
2930
quit $$$OK
3031
}

cls/SourceControl/Git/Utils.cls

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ ClassMethod TempFolder() As %String
3838
if context.IsInGitEnabledPackage {
3939
quit context.Package.Root
4040
}
41+
quit ..DefaultTempFolder()
42+
}
43+
44+
ClassMethod DefaultTempFolder() As %String
45+
{
4146
quit $get(@..#Storage@("settings","namespaceTemp"),..DefaultTemp()_$translate($znspace,"%")_..#Slash)
4247
}
4348

@@ -1124,6 +1129,9 @@ ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
11241129

11251130
ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
11261131
{
1132+
set refContext = ##class(SourceControl.Git.PackageManagerContext).%Get()
1133+
set refPackage = refContext.Package
1134+
11271135
write !, "==import start=="
11281136

11291137
#dim err, itemList
@@ -1138,9 +1146,8 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
11381146
for {
11391147
set internalName = $order(itemList(internalName))
11401148
quit:internalName=""
1141-
if '..IsInSourceControl(internalName) {
1142-
continue
1143-
}
1149+
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
1150+
continue:context.Package'=refPackage
11441151
#dim sc as %Status = ..ImportItem(internalName, force)
11451152
if $$$ISERR(sc) {
11461153
set ec = $$$ADDSC(ec, sc)
@@ -1152,8 +1159,13 @@ ClassMethod ImportRoutines(force As %Boolean = 0) As %Status
11521159
for {
11531160
set item = $order(@..#Storage@("TSH", item))
11541161
quit:item=""
1155-
1156-
if '##class(%File).Exists(..FullExternalName(item)) {
1162+
1163+
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(item)
1164+
continue:context.Package'=refPackage
1165+
1166+
set fullExternalName = ..FullExternalName(item)
1167+
if '##class(%File).Exists(fullExternalName) {
1168+
write !,fullExternalName," does not exist - deleting ",item
11571169
#dim type as %String = ..Type(item)
11581170
#dim name as %String = ..NameWithoutExtension(item)
11591171
#dim deleted as %Boolean = 1
@@ -1287,11 +1299,16 @@ ClassMethod ImportAll(force As %Boolean = 0) As %Status
12871299

12881300
ClassMethod ExportRoutines(force As %Boolean = 0) As %Status
12891301
{
1302+
set refContext = ##class(SourceControl.Git.PackageManagerContext).%Get()
1303+
set refPackage = refContext.Package
1304+
12901305
#dim item as %String = ""
12911306
#dim ec as %Status = $$$OK
12921307
for {
12931308
set item = $order(@..#Storage@("items",item))
12941309
quit:item=""
1310+
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(item)
1311+
continue:context.Package'=refPackage
12951312
set ec = ..ExportItem(item, 1, force)
12961313
quit:'ec
12971314
}
@@ -1398,6 +1415,7 @@ ClassMethod GitStatus(ByRef files, IncludeAllFiles = 0)
13981415
set internalName = ..NameToInternalName(externalName)
13991416
if (internalName '= "") {
14001417
set files(internalName) = $listbuild(operation, externalName)
1418+
set @..#Storage@("items",..NormalizeInternalName(internalName)) = ""
14011419
} elseif ((IncludeAllFiles) && (externalName '= "")) {
14021420
set externalName = $TRANSLATE(externalName, "\", "/")
14031421
set files($I(files)) = $listbuild(operation, externalName)

0 commit comments

Comments
 (0)