Skip to content

Commit

Permalink
#410: added duration to latest commit for a remote branch to mob status
Browse files Browse the repository at this point in the history
  • Loading branch information
hollesse committed Mar 18, 2024
1 parent 20a989f commit 55a778a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
25 changes: 1 addition & 24 deletions mob.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
versionNumber = "4.5.0"
versionNumber = "4.5.1"
minimumGitVersion = "2.13.0"
)

Expand Down Expand Up @@ -887,16 +887,6 @@ func warnForActiveWipBranches(configuration config.Configuration, currentBaseBra
}
}

func showActiveMobSessions(configuration config.Configuration, currentBaseBranch Branch) {
existingWipBranches := getWipBranchesForBaseBranch(currentBaseBranch, configuration)
if len(existingWipBranches) > 0 {
say.Info("remote wip branches detected:")
for _, wipBranch := range existingWipBranches {
say.WithPrefix(wipBranch, " - ")
}
}
}

func sayUntrackedFilesInfo() {
untrackedFiles := getUntrackedFiles()
hasUntrackedFiles := len(untrackedFiles) > 0
Expand Down Expand Up @@ -1190,19 +1180,6 @@ func squashOrCommit(configuration config.Configuration) string {
}
}

func status(configuration config.Configuration) {
if isMobProgramming(configuration) {
currentBaseBranch, currentWipBranch := determineBranches(gitCurrentBranch(), gitBranches(), configuration)
say.Info("you are on wip branch " + currentWipBranch.String() + " (base branch " + currentBaseBranch.String() + ")")

sayLastCommitsList(currentBaseBranch.String(), currentWipBranch.String())
} else {
currentBaseBranch, _ := determineBranches(gitCurrentBranch(), gitBranches(), configuration)
say.Info("you are on base branch '" + currentBaseBranch.String() + "'")
showActiveMobSessions(configuration, currentBaseBranch)
}
}

func sayLastCommitsList(currentBaseBranch string, currentWipBranch string) {
commitsBaseWipBranch := currentBaseBranch + ".." + currentWipBranch
log := silentgit("--no-pager", "log", commitsBaseWipBranch, "--pretty=format:%h %cr <%an>", "--abbrev-commit")
Expand Down
30 changes: 30 additions & 0 deletions status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main

import (
config "github.com/remotemobprogramming/mob/v4/configuration"
"github.com/remotemobprogramming/mob/v4/say"
)

func status(configuration config.Configuration) {
if isMobProgramming(configuration) {
currentBaseBranch, currentWipBranch := determineBranches(gitCurrentBranch(), gitBranches(), configuration)
say.Info("you are on wip branch " + currentWipBranch.String() + " (base branch " + currentBaseBranch.String() + ")")

sayLastCommitsList(currentBaseBranch.String(), currentWipBranch.String())
} else {
currentBaseBranch, _ := determineBranches(gitCurrentBranch(), gitBranches(), configuration)
say.Info("you are on base branch '" + currentBaseBranch.String() + "'")
showActiveMobSessions(configuration, currentBaseBranch)
}
}

func showActiveMobSessions(configuration config.Configuration, currentBaseBranch Branch) {
existingWipBranches := getWipBranchesForBaseBranch(currentBaseBranch, configuration)
if len(existingWipBranches) > 0 {
say.Info("remote wip branches detected:")
for _, wipBranch := range existingWipBranches {
time := silentgit("log", "-1", "--pretty=format:(%ar)", wipBranch)
say.WithPrefix(wipBranch+" "+time, " - ")
}
}
}

0 comments on commit 55a778a

Please sign in to comment.