Skip to content

Commit 66ecfd1

Browse files
committed
added branch property to the PullEventHandler class
1 parent c6cbad3 commit 66ecfd1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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)