| 218 | } |
| 219 | |
| 220 | func (branch Branch) hasUnpushedCommits(configuration config.Configuration) bool { |
| 221 | countOutput := silentgit( |
| 222 | "rev-list", "--count", "--left-only", |
| 223 | "refs/heads/"+branch.Name+"..."+"refs/remotes/"+branch.remote(configuration).Name, |
| 224 | ) |
| 225 | unpushedCount, err := strconv.Atoi(countOutput) |
| 226 | if err != nil { |
| 227 | panic(err) |
| 228 | } |
| 229 | unpushedCommits := unpushedCount != 0 |
| 230 | if unpushedCommits { |
| 231 | say.Info(fmt.Sprintf("there are %d unpushed commits on local base branch <%s>", unpushedCount, branch.Name)) |
| 232 | } |
| 233 | return unpushedCommits |
| 234 | } |
| 235 | |
| 236 | func stringContains(list []string, element string) bool { |
| 237 | found := false |