Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 29, 2018
1 parent b182645 commit 4d99efc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"os"
"sync"

"github.com/pkg/errors"
Expand Down Expand Up @@ -51,8 +52,10 @@ func newPullCommand() *cobra.Command {
}

func pullAndCompute(opts *pullOptions) error {
if err := pull(opts); err != nil {
return errors.Wrap(err, "failed to pull")
if os.Getenv("DEPVIZ_NOPULL") != "1" {
if err := pull(opts); err != nil {
return errors.Wrap(err, "failed to pull")
}
}
if err := compute(opts); err != nil {
return errors.Wrap(err, "failed to compute")
Expand Down
4 changes: 4 additions & 0 deletions compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func compute(opts *pullOptions) error {
//fmt.Println(issue)
}

for _, issue := range issues {
issue.PostLoad()
}

for _, issue := range issues {
if len(issue.Parents) > 0 || len(issue.Children) > 0 {
fmt.Println(issue)
Expand Down
15 changes: 15 additions & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ func (i Issue) GetRelativeURL(target string) string {
return fmt.Sprintf("%s/%s", strings.TrimRight(i.Repository.Provider.URL, "/"), target)
}

func (i *Issue) PostLoad() {
i.ParentIDs = []string{}
i.ChildIDs = []string{}
i.DuplicateIDs = []string{}
for _, rel := range i.Parents {
i.ParentIDs = append(i.ParentIDs, rel.ID)
}
for _, rel := range i.Children {
i.ChildIDs = append(i.ChildIDs, rel.ID)
}
for _, rel := range i.Duplicates {
i.DuplicateIDs = append(i.DuplicateIDs, rel.ID)
}
}

/*
import (
"encoding/json"
Expand Down

0 comments on commit 4d99efc

Please sign in to comment.