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

Method ForEachInOrder

internal/diff/git.go:83–97  ·  view source on GitHub ↗

ForEachInOrder visits Included and Excluded in the original changeset order. providerExcluded is true for built-in directory exclusions. Files dropped by .gitignore are not visited.

(visit func(d model.Diff, providerExcluded bool))

Source from the content-addressed store, hash-verified

81// providerExcluded is true for built-in directory exclusions. Files dropped by
82// .gitignore are not visited.
83func (s DiffSet) ForEachInOrder(visit func(d model.Diff, providerExcluded bool)) {
84 next := 0
85 for i, d := range s.Excluded {
86 // excludedAt[i] is the mixed-stream index, so the number of included
87 // files that precede this exclusion is excludedAt[i]-i.
88 upTo := s.excludedAt[i] - i
89 for ; next < upTo; next++ {
90 visit(s.Included[next], false)
91 }
92 visit(d, true)
93 }
94 for ; next < len(s.Included); next++ {
95 visit(s.Included[next], false)
96 }
97}
98
99// NewProvider creates a Provider for range mode: from..to (via merge-base).
100func NewProvider(repoDir, from, to string, runner *gitcmd.Runner) *Provider {

Calls 1

visitFunction · 0.85