MCPcopy Create free account
hub / github.com/remotemobprogramming/mob / done

Function done

mob.go:950–1012  ·  view source on GitHub ↗
(configuration config.Configuration)

Source from the content-addressed store, hash-verified

948}
949
950func done(configuration config.Configuration) {
951 if !isMobProgramming(configuration) {
952 say.Fix("to start working together, use", configuration.Mob("start"))
953 return
954 }
955
956 git("fetch", configuration.RemoteName, "--prune")
957
958 baseBranch, wipBranch := determineBranches(gitCurrentBranch(), gitBranches(), configuration)
959
960 if wipBranch.hasRemoteBranch(configuration) {
961 if configuration.DoneSquash == config.SquashWip {
962 git("merge", "FETCH_HEAD", "--ff-only")
963 squashWip(configuration)
964 }
965 uncommittedChanges := hasUncommittedChanges()
966 if uncommittedChanges {
967 makeWipCommit(configuration)
968 }
969 gitWithoutEmptyStrings("push", gitHooksOption(configuration), configuration.RemoteName, wipBranch.Name)
970
971 git("checkout", baseBranch.Name)
972 git("merge", baseBranch.remote(configuration).Name, "--ff-only")
973 mergeFailed := gitIgnoreFailure("merge", squashOrCommit(configuration), "--ff", wipBranch.Name)
974
975 if mergeFailed != nil {
976 // TODO should this be an error and a fix for that error?
977 say.Warning("Skipped deleting " + wipBranch.Name + " because of merge conflicts.")
978 say.Warning("To fix this, solve the merge conflict manually, commit, push, and afterwards delete " + wipBranch.Name)
979 return
980 }
981
982 git("branch", "-D", wipBranch.Name)
983
984 if uncommittedChanges && configuration.DoneSquash != config.Squash { // give the user the chance to name their final commit
985 git("reset", "--soft", "HEAD^")
986 }
987
988 gitWithoutEmptyStrings("push", gitHooksOption(configuration), configuration.RemoteName, "--delete", wipBranch.Name)
989
990 cachedChanges := getCachedChanges()
991 hasCachedChanges := len(cachedChanges) > 0
992 if hasCachedChanges {
993 say.InfoIndented(cachedChanges)
994 }
995 err := appendCoauthorsToSquashMsg(gitDir())
996 if err != nil {
997 say.Warning(err.Error())
998 }
999
1000 if hasUncommittedChanges() {
1001 say.Next("To finish, use", "git commit")
1002 } else if configuration.DoneSquash == config.Squash {
1003 say.Info("nothing was done, so nothing to commit")
1004 }
1005
1006 } else {
1007 git("checkout", baseBranch.Name)

Calls 15

FixFunction · 0.92
WarningFunction · 0.92
InfoIndentedFunction · 0.92
NextFunction · 0.92
InfoFunction · 0.92
isMobProgrammingFunction · 0.85
gitFunction · 0.85
determineBranchesFunction · 0.85
gitCurrentBranchFunction · 0.85
gitBranchesFunction · 0.85
squashWipFunction · 0.85
hasUncommittedChangesFunction · 0.85