Monorepo for Tangled tangled.org

appview/pulls: use linked-list ordering for stacked PRs #1236

open opened by murex.tngl.sh targeting master from murex.tngl.sh/tangled: fix/stack-order
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:owyua2lvxbs55wyhs22dqu2s/sh.tangled.repo.pull/3mi7subuyl522
+13 -3
Diff #0
+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
sign up or login to add to the discussion
murex.tngl.sh submitted #0
1 commit
expand
appview/pulls: use linked-list ordering for stacked PRs
merge conflicts detected
expand
  • appview/pulls/pulls.go:684
expand 2 comments

atprotation for PRs is in progress here, which indirectly fixes this issue. so i would like to put this PR on hold until that lands.