From 66ecfd12f746619e3936a0b1e4a4b2662cc6089d Mon Sep 17 00:00:00 2001 From: Henry Wojnicki Date: Thu, 6 Jun 2024 14:34:57 -0400 Subject: [PATCH 1/2] added branch property to the PullEventHandler class --- cls/SourceControl/Git/PullEventHandler.cls | 3 +++ cls/SourceControl/Git/Utils.cls | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/cls/SourceControl/Git/PullEventHandler.cls b/cls/SourceControl/Git/PullEventHandler.cls index cc7d7baa..3dfb3a4c 100644 --- a/cls/SourceControl/Git/PullEventHandler.cls +++ b/cls/SourceControl/Git/PullEventHandler.cls @@ -13,6 +13,9 @@ Property LocalRoot As %String(MAXLEN = ""); /// Modified files (integer-subscripted array storing objects of class SourceControl.Git.Modification) Property ModifiedFiles [ MultiDimensional ]; +/// The branch that is checked out before OnPull() is called +Property Branch [ InitialExpression = {##class(SourceControl.Git.Utils).GetCurrentBranch()} ]; + Method OnPull() As %Status [ Abstract ] { } diff --git a/cls/SourceControl/Git/Utils.cls b/cls/SourceControl/Git/Utils.cls index 74f809b0..351c631d 100644 --- a/cls/SourceControl/Git/Utils.cls +++ b/cls/SourceControl/Git/Utils.cls @@ -344,6 +344,12 @@ ClassMethod Fetch(ByRef diffFiles) As %Status quit $$$OK } +ClassMethod GetCurrentBranch() As %String{ + do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current") + set branchName = outStream.ReadLine(outStream.Size) + quit branchName +} + ClassMethod Pull(remote As %String = "origin", preview As %Boolean = 0) As %Status { #define Force 1 From 9f9964ed565ad05a6354f988312ae845ad4e959b Mon Sep 17 00:00:00 2001 From: Henry Wojnicki Date: Thu, 6 Jun 2024 14:39:00 -0400 Subject: [PATCH 2/2] added change in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e39089..048e7dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Pre-release support for IPM v0.9.0+ - Items mapped from database other than namespace's default routine database are now ignored by default when exporting or adding files - New setting to configure whether mapped items should be should be treated as read-only +- Added a new "Branch" parameter to `##class(SourceControl.Git.PullEventHandler)` (#351) ## [2.3.1] - 2024-04-30