Process commits in reverse
Dependencies
- [2]
5ETDKF5FStart on data structures to represent fast-export stream - [3]
KZ4XMKSPMake a temporary clone of the repository - [4]
RTQQLOCOUse real metadata, but no content yet - [*]
Y7VFVY6EInitial dummy version
Change contents
- replacement in main.go at line 75
for changeIndex := len(changes) - 1; changeIndex >= 0; changeIndex-- {c := changes[changeIndex]stream := new(FastExportStream)for changeIndex, c := range changes { - edit in main.go at line 84
commit.Mark = nextMark() - replacement in main.go at line 99
if err := commit.WriteTo(os.Stdout); err != nil {printErrorAndExit("Error writing commit:", err)}stream.AddCommit(commit)}stream.ReverseCommits()if err := stream.WriteTo(os.Stdout); err != nil {printErrorAndExit("Error writing output stream:", err) - edit in fast-export.go at line 36
}return nil}// A FastExportStream is an in-memory representation of a fast-export stream.type FastExportStream struct {Commits []Commitmarks int}func (f *FastExportStream) AddCommit(c Commit) {if c.Mark == 0 {f.marks++c.Mark = f.marks}f.Commits = append(f.Commits, c)}func (f *FastExportStream) ReverseCommits() {for i, j := 0, len(f.Commits)-1; j > i; i, j = i+1, j-1 {f.Commits[i], f.Commits[j] = f.Commits[j], f.Commits[i] - edit in fast-export.go at line 59
}func (f *FastExportStream) WriteTo(w io.Writer) error {for _, c := range f.Commits {if err := c.WriteTo(w); err != nil {return err}}