Skip to content

Commit 78a8871

Browse files
authored
Merge pull request #353 from intersystems/add-branch-name-to-pull-event-handler
Issue #351 added branch property to the PullEventHandler class
2 parents 83d71e8 + c0750cb commit 78a8871

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Pre-release support for IPM v0.9.0+
1313
- Items mapped from database other than namespace's default routine database are now ignored by default when exporting or adding files
1414
- New setting to configure whether mapped items should be should be treated as read-only
15+
- Added a new "Branch" parameter to `##class(SourceControl.Git.PullEventHandler)` (#35
1516
- Command-line utility to do a baseline export of items in a namespace
1617

1718
## [2.3.1] - 2024-04-30

cls/SourceControl/Git/PullEventHandler.cls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Property LocalRoot As %String(MAXLEN = "");
1313
/// Modified files (integer-subscripted array storing objects of class SourceControl.Git.Modification)
1414
Property ModifiedFiles [ MultiDimensional ];
1515

16+
/// The branch that is checked out before OnPull() is called
17+
Property Branch [ InitialExpression = {##class(SourceControl.Git.Utils).GetCurrentBranch()} ];
18+
1619
Method OnPull() As %Status [ Abstract ]
1720
{
1821
}

cls/SourceControl/Git/Utils.cls

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ ClassMethod Fetch(ByRef diffFiles) As %Status
344344
quit $$$OK
345345
}
346346

347+
ClassMethod GetCurrentBranch() As %String{
348+
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("branch",,.errStream,.outStream,"--show-current")
349+
set branchName = outStream.ReadLine(outStream.Size)
350+
quit branchName
351+
}
352+
347353
ClassMethod Pull(remote As %String = "origin", preview As %Boolean = 0) As %Status
348354
{
349355
#define Force 1

0 commit comments

Comments
 (0)