Commit 4b736dc7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 86070cba
......@@ -152,18 +152,24 @@ def Trees(zstor, r):
defer(zctx.close)
ztree = zctx.root['treegen/tree'] = XLOTree()
at0 = commit('treegen/tree: init')
xprint("start @%s root=%s" % (ashex(at0), ashex(ztree._p_oid)))
head = commit('treegen/tree: init')
xprint("start @%s root=%s" % (ashex(head), ashex(ztree._p_oid)))
treetxtPrev = zctx.TopoEncode(ztree)
while 1:
treetxt = r.readline()
if treetxt == '':
break # EOF
treetxt = treetxt.rstrip() # trim trailing \n
# skip changing DB if the same topology is requested twice
# (this avoids assert in commit that len(resources) == 1)
if treetxt == treetxtPrev:
xprint("%s" % ashex(head))
continue
treetxtPrev = treetxt
tree = zctx.TopoDecode(treetxt)
# ztree = trees[treetxt] = XLOTree()
# zctx.zconn.add(ztree) # so that restructure can see we are working under zconn
# treekv[k]=v for all k
# do tree.keys() via walkBFS
......@@ -184,11 +190,11 @@ def Trees(zstor, r):
# restructure ztree to requested topology
xbtree.Restructure(ztree, tree)
tid = commit("treegen/trees: %s" % treetxt)
head = commit("treegen/trees: %s" % treetxt)
# XXX print more details?
# XXX print just tid (as `zodb commit` does) ?
#print("txn %s -> tree(%s) %s" % (ashex(tid), ashex(ztree._p_oid), treetxt))
print("%s" % ashex(tid))
#xprint("txn %s -> tree(%s) %s" % (ashex(tid), ashex(ztree._p_oid), treetxt))
xprint("%s" % ashex(head))
# AllStructs generates subset of all possible tree changes in
......
......@@ -121,6 +121,7 @@ func (tg *TreeGen) Close() (err error) {
// Commit creates new commit with underlying tree changed to tree topology.
func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) {
defer xerr.Contextf(&err, "treegen %s: commit %s", tg.zurl, tree)
fmt.Printf("commit %s ...\n", tree)
_, err = io.WriteString(tg.pyin, tree + "\n")
if err != nil {
......
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