summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--branches.go20
-rw-r--r--currentVersions.go2
-rw-r--r--reloadRepoState.go3
3 files changed, 12 insertions, 13 deletions
diff --git a/branches.go b/branches.go
index 3b642c1..378505e 100644
--- a/branches.go
+++ b/branches.go
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
- "go.wit.com/log"
+ "github.com/go-cmd/cmd"
)
// returns true if 'git pull' will work
@@ -72,10 +72,11 @@ func (repo *Repo) DeleteLocalDevelBranch() error {
if !repo.IsDevelRemote() {
return fmt.Errorf("no remote branch")
}
+
b1 := repo.CountDiffObjects(branch, remote) // should be zero
if b1 == 0 {
cmd := []string{"git", "branch", "-D", repo.GetDevelBranchName()}
- log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd)
+ // log.Info("DEVEL IS IN REMOTE", repo.GetGoPath(), cmd)
err := repo.RunVerbose(cmd)
return err
} else {
@@ -85,26 +86,27 @@ func (repo *Repo) DeleteLocalDevelBranch() error {
// makes a local branch based off of the master branch
// (unless a remote devel branch exists. then it uses that)
-func (repo *Repo) MakeLocalDevelBranch() error {
+func (repo *Repo) MakeLocalDevelBranch() (*cmd.Status, error) {
branch := repo.GetDevelBranchName()
if branch == "" {
// hard coded default
branch = "devel"
}
+
if repo.Exists(filepath.Join(".git/refs/heads", branch)) {
// local devel branch already exists
- return nil
+ return nil, nil
}
+
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branch)) {
// remote devel branch exists, but local does not
cmd := []string{"git", "checkout", branch}
- repo.RunVerbose(cmd)
- return nil
+ return repo.RunVerboseOnError(cmd)
}
+
master := repo.GetMasterBranchName()
cmd := []string{"git", "branch", branch, master}
- repo.RunVerbose(cmd)
+ repo.RunVerboseOnError(cmd)
cmd = []string{"git", "checkout", branch}
- repo.RunVerbose(cmd)
- return nil
+ return repo.RunVerboseOnError(cmd)
}
diff --git a/currentVersions.go b/currentVersions.go
index 495d1ec..20d9aee 100644
--- a/currentVersions.go
+++ b/currentVersions.go
@@ -145,7 +145,7 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
}
if !repo.IsBranch(name) {
// tag does not exist
- log.Log(WARN, "LocalTagExists()", name, "did not exist")
+ // log.Log(WARN, "LocalTagExists()", name, "did not exist")
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name)
}
cmd := []string{"git", "describe", "--tags", "--always", name}
diff --git a/reloadRepoState.go b/reloadRepoState.go
index 296d43d..4b7eac6 100644
--- a/reloadRepoState.go
+++ b/reloadRepoState.go
@@ -53,9 +53,6 @@ func (repo *Repo) setRepoState() {
repo.State = "PERFECT"
return
}
- log.Info("Branches are not Perfect", repo.GetFullPath())
- log.Info("Branches are not Perfect", repo.GetFullPath())
- log.Info("Branches are not Perfect", repo.GetFullPath())
repo.State = "unknown branches"
}