MCPcopy Create free account
hub / github.com/alibaba/open-code-review / ForEachInOrder

Method ForEachInOrder

internal/diff/git.go:86–100  ·  view source on GitHub ↗

ForEachInOrder visits Included and Excluded in the original changeset order. providerReason is ExcludeNone for a diff the review may process, and otherwise says which provider-level rule removed it.

(visit func(d model.Diff, providerReason model.ExcludeReason))

Source from the content-addressed store, hash-verified

84// providerReason is ExcludeNone for a diff the review may process, and
85// otherwise says which provider-level rule removed it.
86func (s DiffSet) ForEachInOrder(visit func(d model.Diff, providerReason model.ExcludeReason)) {
87 next := 0
88 for i, d := range s.Excluded {
89 // excludedAt[i] is the mixed-stream index, so the number of included
90 // files that precede this exclusion is excludedAt[i]-i.
91 upTo := s.excludedAt[i] - i
92 for ; next < upTo; next++ {
93 visit(s.Included[next], model.ExcludeNone)
94 }
95 visit(d, s.excludedReason[i])
96 }
97 for ; next < len(s.Included); next++ {
98 visit(s.Included[next], model.ExcludeNone)
99 }
100}
101
102// NewProvider creates a Provider for range mode: from..to (via merge-base).
103func NewProvider(repoDir, from, to string, runner *gitcmd.Runner) *Provider {

Calls 1

visitFunction · 0.85