Commit c5552417 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 578232ad
...@@ -221,9 +221,27 @@ def TreesSrv(zstor, r): ...@@ -221,9 +221,27 @@ def TreesSrv(zstor, r):
assert D.startswith('D') assert D.startswith('D')
kv = kvDecode(t[1:], zctx.vdecode) kv = kvDecode(t[1:], zctx.vdecode)
zv = _kvDecode(D[1:], kdecode=lambda ktxt: ktxt, vdecode=lambda vtxt: vtxt) zv = _kvDecode(D[1:], kdecode=lambda ktxt: ktxt, vdecode=lambda vtxt: vtxt)
zdataTab = zctx.root['treegen/values']
patch(ztree, diff(ztree, kv), kv) patch(ztree, diff(ztree, kv), kv)
patch(zdataTab, diff(zdataTab, zv), zv) # XXX v->ZBlk(v)
# ~ patch(valdict, diff(valdict,zv)) but sets zblk.value on change
valdict = zctx.root['treegen/values']
vkeys = set(valdict.keys())
vkeys.update(zv.keys())
for k in vkeys:
zblk = valdict.get(k)
v1 = None
if zblk is not None:
v1 = zblk.loadblkdata()
v2 = zv.get(k)
if v1 != v2:
if v1 is None:
zblk = ZBlk()
valdict[k] = zblk
if v2 is not None:
zblk.setblkdata(v2)
zblk._p_changed = True
elif v2 is None:
del valdict[k]
head = commit(subj) head = commit(subj)
xprint("%s" % ashex(head)) xprint("%s" % ashex(head))
......
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