quiet older printf's to STDOUT
This commit is contained in:
parent
f08a517bc4
commit
aef107af0d
20
branches.go
20
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)
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue