MCPcopy Index your code
hub / github.com/redspread/spread / Diff

Method Diff

pkg/deploy/deployment.go:178–195  ·  view source on GitHub ↗

Diff returns the difference between the textual representation of two deployments

(other *Deployment)

Source from the content-addressed store, hash-verified

176
177// Diff returns the difference between the textual representation of two deployments
178func (d *Deployment) Diff(other *Deployment) string {
179 if other == nil {
180 return "other was nil"
181 }
182 diff := difflib.UnifiedDiff{
183 A: difflib.SplitLines(d.String()),
184 B: difflib.SplitLines(other.String()),
185 FromFile: "ThisDeployment",
186 ToFile: "OtherDeployment",
187 }
188
189 out, err := difflib.GetUnifiedDiffString(diff)
190 if err != nil {
191 panic(err)
192 }
193
194 return out
195}
196
197// PathDiff returns the list of the paths of objects.
198// Currently doesn't detect modifications

Callers 2

testCompareEntityFunction · 0.45
testDeploymentEqualFunction · 0.45

Calls 1

StringMethod · 0.95

Tested by 2

testCompareEntityFunction · 0.36
testDeploymentEqualFunction · 0.36