Signed-off-by: Nupur Agrawal nupur202000@gmail.com
+13
-3
Diff
round #0
+13
-3
appview/pulls/pulls.go
+13
-3
appview/pulls/pulls.go
···
684
684
685
685
// we want to group all stacked PRs into just one list
686
686
stacks := make(map[string]models.Stack)
687
+
stackIds := make(map[string]struct{})
687
688
var shas []string
688
689
n := 0
689
690
for _, p := range pulls {
···
692
693
// this PR is stacked
693
694
if p.StackId != "" {
694
695
// we have already seen this PR stack
695
-
if _, seen := stacks[p.StackId]; seen {
696
-
stacks[p.StackId] = append(stacks[p.StackId], p)
696
+
if _, seen := stackIds[p.StackId]; seen {
697
697
// skip this PR
698
698
} else {
699
-
stacks[p.StackId] = nil
699
+
stackIds[p.StackId] = struct{}{}
700
700
pulls[n] = p
701
701
n++
702
702
}
···
707
707
}
708
708
pulls = pulls[:n]
709
709
710
+
// Populate stacks using canonical linked-list ordering.
711
+
for sid := range stackIds {
712
+
st, err := db.GetStack(s.db, sid)
713
+
if err != nil {
714
+
l.Error("failed to get stack", "stack_id", sid, "err", err)
715
+
continue
716
+
}
717
+
stacks[sid] = st
718
+
}
719
+
710
720
ps, err := db.GetPipelineStatuses(
711
721
s.db,
712
722
len(shas),
History
1 round
2 comments
murex.tngl.sh
submitted
#0
1 commit
expand
collapse
appview/pulls: use linked-list ordering for stacked PRs
Signed-off-by: Nupur Agrawal <nupur202000@gmail.com>
merge conflicts detected
expand
collapse
expand
collapse
- appview/pulls/pulls.go:684
addresses https://tangled.org/tangled.org/core/issues/221