Commit 124a8543 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4b24bab6
......@@ -332,10 +332,10 @@ func (tidx trackIndex) verify() {
//
// In other words it removes B nodes from A while still maintaining A as P-connected.
func (A trackIndex) DifferenceInplace(B trackIndex) {
//fmt.Printf("\n\nDifferenceInplace:\n")
//fmt.Printf(" A: %s\n", A)
//fmt.Printf(" B: %s\n", B)
//defer fmt.Printf("->D: %s\n", A)
fmt.Printf("\n\nDifferenceInplace:\n")
fmt.Printf(" A: %s\n", A)
fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->D: %s\n", A)
A.verify()
B.verify()
......@@ -402,10 +402,10 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
//
// In other words it adds B nodes to A.
func (A trackIndex) UnionInplace(B trackIndex) {
//fmt.Printf("\n\nUnionInplace:\n")
//fmt.Printf(" A: %s\n", A)
//fmt.Printf(" B: %s\n", B)
//defer fmt.Printf("->U: %s\n", A)
fmt.Printf("\n\nUnionInplace:\n")
fmt.Printf(" A: %s\n", A)
fmt.Printf(" B: %s\n", B)
defer fmt.Printf("->U: %s\n", A)
A.verify()
B.verify()
......@@ -439,11 +439,11 @@ func (A trackIndex) UnionInplace(B trackIndex) {
// ApplyΔ applies δ to trackIdx. XXX
func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
//fmt.Printf("\n\nApplyΔ\n")
//fmt.Printf(" A: %s\n", tidx)
//fmt.Printf(" -: %s\n", δ.Del)
//fmt.Printf(" +: %s\n", δ.Add)
//defer fmt.Printf("\n->B: %s\n", tidx)
fmt.Printf("\n\nApplyΔ\n")
fmt.Printf(" A: %s\n", tidx)
fmt.Printf(" -: %s\n", δ.Del)
fmt.Printf(" +: %s\n", δ.Add)
defer fmt.Printf("\n->B: %s\n", tidx)
tidx.verify()
δ.Del.verify()
......@@ -1414,9 +1414,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// adjust trackIdx since path to the node could have changed
apath := trackIdx.Path(acOid)
bpath := BtrackIdx.Path(acOid)
if !reflect.DeepEqual(apath, bpath) {
δtrack.Del.AddPath(apath)
if !pathEqual(apath, bpath) {
δtrack.Add.AddPath(bpath)
δtrack.Del.AddPath(apath)
// remove all nodes from under a XXX no
// XXX (a was not changed and nothing under a was changed) -> we just have to correct path till a.
}
/* XXX kill
......@@ -1878,6 +1880,19 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
return top
}
// pathEqual returns whether two paths are the same.
func pathEqual(patha, pathb []zodb.Oid) bool {
if len(patha) != len(pathb) {
return false
}
for i, a := range patha {
if pathb[i] != a {
return false
}
}
return true
}
const debug = false
func tracef(format string, argv ...interface{}) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment