summaryrefslogtreecommitdiff
path: root/doVerifyUser.go
blob: 8c1013c860790943b24be7641b5c8ecabda9ae0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main

import (
	"go.wit.com/lib/protobuf/gitpb"
	"go.wit.com/log"
)

func doVerifyUser() error {
	me.found = new(gitpb.Repos)
	all := me.forge.Repos.SortByFullPath()
	for all.Scan() {
		repo := all.Next()
		if repo.IsDirty() {
			log.Info(repo.GetGoPath(), "is dirty")
			me.found.AppendByGoPath(repo)
			continue
		}
		if repo.ExistsUserBranchRemote() {
		}

		if repo.ExistsUserBranch() {
		}
		if repo.GetMasterBranchName() == repo.GetCurrentBranchName() {
			log.Info(repo.GetGoPath(), "is not on master branch")
			continue
		}

		devel := repo.GetDevelBranchName()
		if argv.Verbose {
			log.Printf("Start clean devel branch: %s %s\n", repo.GetGoPath(), devel)
		}

		// check if devel branch exists in remote repo
		if repo.IsBranchRemote(devel) {
			if err := doCleanDevelRepo(repo); err != nil {
				log.Info(repo.GetGoPath(), "verify clean failed")
			}
			// can not continue
			continue
		}
		// devel branch is only local
		/*
			todo: something?
				devname := repo.GetDevelBranchName()
				if err := requiresGitPush(repo, devname); err != nil {
					log.Info(repo.GetGoPath(), "is out of sync with upstream")
					return err
				}
		*/
	}
	return nil
}

func verifyRemoteUserBranch(repo *gitpb.Repo) {
}