Skip to content

Commit ad8f961

Browse files
committed
enh: IPM pull event handler that uninstalls first
1 parent ae81586 commit ad8f961

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ 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.11.0] - Unreleased
9+
10+
### Added
11+
- Pull event handler that does an IPM uninstall and load to handle deletes (#631)
12+
813
## [2.10.0] - 2025-02-10
914

1015
### Added
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Class SourceControl.Git.PullEventHandler.PackageManagerReload Extends SourceControl.Git.PullEventHandler
2+
{
3+
4+
Parameter NAME = "Package Manager Reload";
5+
6+
Parameter DESCRIPTION = "Does zpm ""uninstall"", then zpm ""load <repo root>""";
7+
8+
/// Subclasses may override to customize behavior on pull.
9+
Method OnPull() As %Status
10+
{
11+
set moduleFilePath = ##class(%File).NormalizeFilename("module.xml",..LocalRoot)
12+
set sc = $System.OBJ.Load(moduleFilePath,"-d",,.internalName,1) // list-only load to get module name
13+
$$$QuitOnError(sc)
14+
set context = ##class(SourceControl.Git.PackageManagerContext).ForInternalName(internalName)
15+
if $isobject(context.Package) {
16+
set sc = ##class(%ZPM.PackageManager).Shell("uninstall "_context.Package.Name)
17+
$$$QuitOnError(sc)
18+
}
19+
quit ##class(%ZPM.PackageManager).Shell("load "_..LocalRoot)
20+
}
21+
22+
}

0 commit comments

Comments
 (0)