summaryrefslogtreecommitdiff
path: root/doList.go
blob: 382c08350219ecea91cddcd3188aec667f06c624 (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
package main

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

func doList() error {
	log.Info("do list here")

	if err := me.forge.LoadPatchsets(); err != nil {
		badExit(err)
	}

	// first show the general patchset protobuf
	for pb := range me.forge.Patchsets.IterAll() {
		if pb.Name == "forge auto commit" {
			pb.ShowPatchsets()
		}
	}

	// show all the patchsets with Names
	for pset := range me.forge.Patchsets.IterAll() {
		if pset.Name == "forge auto commit" {
			continue
		}
		pset.ShowPatchsets()
	}
	return nil
}

// returns true if the patch already exists in the protobuf
func findPatch(newpatch *forgepb.Patch) bool {
	// log.Info("\tlook for patch:", newpatch.CommitHash, newpatch.Namespace)

	for pset := range me.forge.Patchsets.IterAll() {
		for _, patch := range pset.Patches.Patches {
			if patch.CommitHash == newpatch.CommitHash {
				// log.Info("\tfound pset!!!!!!", pset.Uuid, patch.Namespace)
				return true
			}

		}
	}

	return false
}