Commit 231a8e52 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fe540a04
......@@ -212,9 +212,9 @@ type δtrackIndex struct {
// ApplyΔ applies δ to trackIdx. XXX
func (tidx trackIndex) ApplyΔ(δ *δtrackIndex) {
//fmt.Printf("\n\nApplyΔ\n")
//fmt.Printf("\tDelLeaf: %v\n", δ.DelLeaf)
//fmt.Printf("\tAdd: %v\n", δ.Add)
fmt.Printf("\n\nApplyΔ\n")
fmt.Printf("\tDelLeaf: %v\n", δ.DelLeaf)
fmt.Printf("\tAdd: %v\n", δ.Add)
// remove leafs and thier parents
for leaf := range δ.DelLeaf {
......@@ -949,8 +949,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// XXX -> trackIndex
BtrackIdx := map[zodb.Oid]nodeTrack{B.POid(): nodeTrack{parent: trackIdx[B.POid()].parent}}
// trackAdd := SetNode{} // leaf nodes to be added to trackIdx after treediff
// phase 1: expand A top->down driven by δZTC.
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
......@@ -1031,7 +1029,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
bcOid := bc.node.POid()
BtrackIdx[bcOid] = nodeTrack{parent: blo.node.POid()}
if acOid == bcOid {
found = true
found = true
}
}
if found {
......@@ -1042,6 +1040,19 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
if found {
// ac can be skipped
// XXX Bkqueue <- holes(ac.range \ bc.range) XXX test for this
// adjust trackIdx since path to the node could have changed
oid := acOid
for oid != zodb.InvalidOid {
told := trackIdx[oid]
tnew := BtrackIdx[oid]
if told.parent != tnew.parent {
δtrack.Add[oid] = &tnew // XXX adjust nchildren
}
oid = tnew.parent
}
continue
}
}
......@@ -1096,7 +1107,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// δ <- δB
err = δMerge(δ, δB); /*X*/if err != nil { return nil,nil, err }
δtrack.Add.AddPath(b.Path())
// trackAdd.Add(b)
// Akqueue <- δB
for k_ := range δB {
......@@ -1476,7 +1486,7 @@ func pop(nodeStk *[]*nodeInRange) *nodeInRange {
}
const debug = false
const debug = true
func tracef(format string, argv ...interface{}) {
if debug {
fmt.Printf(format, argv...)
......
......@@ -1054,7 +1054,7 @@ func TestΔBTail(t *testing.T) {
"T2/T1-T/B0:g-B1:b-T/B2:b,3:a",
"T2/T1-T/T-T-B2:a/B0:c-B1:g",
// found by AllStructs (XXX)
// found by AllStructs (unchanged node is reparented)
"T1/B0:c-B1:f",
"T1/T-T/B0:c-T/B1:h",
}
......
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