MCPcopy Create free account
hub / github.com/sergi/go-diff / PatchToText

Method PatchToText

diffmatchpatch/patch.go:581–587  ·  view source on GitHub ↗

PatchToText takes a list of patches and returns a textual representation.

(patches []Patch)

Source from the content-addressed store, hash-verified

579
580// PatchToText takes a list of patches and returns a textual representation.
581func (dmp *DiffMatchPatch) PatchToText(patches []Patch) string {
582 var text bytes.Buffer
583 for _, aPatch := range patches {
584 _, _ = text.WriteString(aPatch.String())
585 }
586 return text.String()
587}
588
589var patchHeaderRegex = regexp.MustCompile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$")
590

Callers 6

TestPatchToTextFunction · 0.80
TestPatchSplitMaxFunction · 0.80
TestPatchAddPaddingFunction · 0.80
BenchmarkPatchFromTextFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 6

TestPatchToTextFunction · 0.64
TestPatchSplitMaxFunction · 0.64
TestPatchAddPaddingFunction · 0.64
BenchmarkPatchFromTextFunction · 0.64