Include file content
Dependencies
- [2]
K23EJ6EJProcess commits in reverse - [3]
5ETDKF5FStart on data structures to represent fast-export stream - [*]
Y7VFVY6EInitial dummy version - [*]
RTQQLOCOUse real metadata, but no content yet
Change contents
- edit in main.go at line 81[6.1212][6.1212]
}if changeIndex > 0 {if _, err := exec.Command("pijul", "unrecord", changes[changeIndex-1].Hash).Output(); err != nil {printErrorAndExit("Error unrecording change "+changes[changeIndex-1].Hash+":", err)}if _, err := exec.Command("pijul", "reset").Output(); err != nil {printErrorAndExit("Error from pijul reset:", err)} - edit in main.go at line 107
// To specify the content for the commit, we remove everything// and then add back in all the files that are present after the change.commit.DeleteAll = truelisting, err := exec.Command("pijul", "list").Output()if err != nil {printErrorAndExit("Error from pijul list:", err)}for _, f := range strings.Split(string(listing), "\n") {if f == "" {continue}info, err := os.Stat(f)if err != nil {printErrorAndExit("Error from Stat:", err)}if info.IsDir() {continue}data, err := os.ReadFile(f)if err != nil {printErrorAndExit("Error reading "+f+":", err)}b := stream.AddBlob(data)commit.Modifications = append(commit.Modifications, FileModify{Blob: b, Path: f})} - edit in fast-export.go at line 8
type FileModify struct {Blob intPath string} - edit in fast-export.go at line 14
func (f FileModify) WriteTo(w io.Writer) error {_, err := fmt.Fprintf(w, "M 644 :%d %s\n", f.Blob, f.Path)return err} - replacement in fast-export.go at line 20
Mark intCommitter stringTimestamp time.TimeMessage stringMark intCommitter stringTimestamp time.TimeMessage stringDeleteAll boolModifications []FileModify - edit in fast-export.go at line 45
}if c.DeleteAll {if _, err := fmt.Fprintln(w, "deleteall"); err != nil {return err}}for _, m := range c.Modifications {if err := m.WriteTo(w); err != nil {return err} - edit in fast-export.go at line 62
type Blob struct {Mark intData []byte}func (b Blob) WriteTo(w io.Writer) error {if _, err := fmt.Fprintln(w, "blob"); err != nil {return err}if b.Mark != 0 {if _, err := fmt.Fprintf(w, "mark :%d\n", b.Mark); err != nil {return err}}if _, err := fmt.Fprintln(w, "data", len(b.Data)); err != nil {return err}if _, err := w.Write(b.Data); err != nil {return err}if _, err := fmt.Fprintln(w); err != nil {return err}return nil} - edit in fast-export.go at line 91
Blobs []Blob - edit in fast-export.go at line 111
for _, b := range f.Blobs {if err := b.WriteTo(w); err != nil {return err}} - edit in fast-export.go at line 122
}// AddBlob adds a blob to the stream and returns its mark.func (f *FastExportStream) AddBlob(data []byte) int {f.marks++b := Blob{Mark: f.marks,Data: data,}f.Blobs = append(f.Blobs, b)return b.Mark