diff options
Diffstat (limited to 'patchset.Get.go')
| -rw-r--r-- | patchset.Get.go | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/patchset.Get.go b/patchset.Get.go index 5904914..3f4123a 100644 --- a/patchset.Get.go +++ b/patchset.Get.go @@ -23,12 +23,6 @@ func (f *Forge) GetPatches() error { log.Info("Unmarshal failed", err) return err } - /* - filename := filepath.Join("/tmp", pbfile) - f, _ := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) - f.Write(body) - f.Close() - */ psets.PrintTable() f.loadUpstreamPatchsets(psets) return nil @@ -40,6 +34,7 @@ func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) { for all.Scan() { pset := all.Next() found := f.Patchsets.FindByUuid(pset.Uuid) + author := log.Sprintf("Author: %s <%s>", found.GitAuthorName, found.GitAuthorEmail) if found == nil { log.Info("new patchset", pset.Name, pset.Uuid) pset.State = "new" @@ -52,14 +47,28 @@ func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) { log.Warn("OH NO! f.Patchsets == nil") continue } + log.Warn("appending pset", pset.Uuid, pset.State, pset.Name) f.Patchsets.Append(pset) - } else { - log.Info("patchset already on disk", found.Name, found.State) - pset.State = found.State - if pset.State == "" { - pset.State = "new" + continue + } + log.Info("EXAMINE PSET", pset.Name, pset.Uuid, pset.Patches.Len()) + for _, patch := range pset.Patches.Patches { + // log.Info("\tnew patch:", i, patch.CommitHash, patch.Namespace) + if f.findPatch(patch) { + // log.Info("\talready found!!!!!!!", pset.Uuid, patch.Namespace) + continue + } + if err := f.addRandomPatch(patch); err == nil { + log.Info("\tnew patch added:", patch.CommitHash, found.Name, found.Comment, author) + foundnew = true + } else { + log.Info("\tnew patch failed:", patch.CommitHash, found.Name, found.Comment, author, err) } } + pset.State = found.State + if pset.State == "" { + pset.State = "new" + } } if foundnew { f.SavePatchsets() |
