Skip to content

Commit 03a52c2

Browse files
Add GetCurrentRevision class method
1 parent 84447a4 commit 03a52c2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ ClassMethod MergeDefaultRemoteBranch(Output alert As %String = "") As %Boolean
447447
do ..RunGitWithArgs(.errStream, .outStream, "fetch", "origin", defaultMergeBranch_":"_defaultMergeBranch)
448448
do ..PrintStreams(errStream, outStream)
449449

450-
do ..RunGitWithArgs(,.outStream, "rev-parse", "HEAD")
451-
set startSha = outStream.ReadLine()
450+
set startSha = ..GetCurrentRevision()
452451

453452
// Start a transaction so code changes can be rolled back
454453
set initTLevel = $TLevel
@@ -556,6 +555,13 @@ ClassMethod GetCurrentBranch() As %String
556555
quit branchName
557556
}
558557

558+
ClassMethod GetCurrentRevision() As %String
559+
{
560+
do ##class(SourceControl.Git.Utils).RunGitCommandWithInput("rev-parse",,.errStream,.outStream,"HEAD")
561+
set revision = outStream.ReadLine(outStream.Size)
562+
quit revision
563+
}
564+
559565
ClassMethod Pull(remote As %String = "origin") As %Status
560566
{
561567
New %gitSCOutputFlag

0 commit comments

Comments
 (0)