Commit d719ee18 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e36acaf5
...@@ -158,15 +158,7 @@ def Trees(zstor, r): ...@@ -158,15 +158,7 @@ def Trees(zstor, r):
xprint("tree.srv start @%s root=%s" % (ashex(head), ashex(ztree._p_oid))) xprint("tree.srv start @%s root=%s" % (ashex(head), ashex(ztree._p_oid)))
treetxtPrev = zctx.ztreetxt(ztree) treetxtPrev = zctx.ztreetxt(ztree)
# XXX dup wrt AllStructsSrv for treetxt in xreadlines(r):
while 1:
treetxt = r.readline()
if treetxt == '':
break # EOF
treetxt = treetxt.rstrip() # trim trailing \n
if treetxt.startswith('#'):
continue # skip comments
# mark tree as changed if the same topology is requested twice # mark tree as changed if the same topology is requested twice
# this ensures we can actually make a non-empty commit # this ensures we can actually make a non-empty commit
if treetxt == treetxtPrev: if treetxt == treetxtPrev:
...@@ -215,15 +207,7 @@ def Trees(zstor, r): ...@@ -215,15 +207,7 @@ def Trees(zstor, r):
@func @func
def AllStructsSrv(r): def AllStructsSrv(r):
xprint('# allstructs.srv start') xprint('# allstructs.srv start')
# XXX dup wrt Trees for req in xreadlines(r):
while 1:
req = r.readline()
if req == '':
break # EOF
req = req.rstrip() # trim trailing \n
if req.startswith('#'):
continue # skip comments
# maxdepth maxsplit n(/seed) kv1 kv2 # maxdepth maxsplit n(/seed) kv1 kv2
maxdepth, maxsplit, n, kv1txt, kv2txt = req.split() maxdepth, maxsplit, n, kv1txt, kv2txt = req.split()
maxdepth = int(maxdepth) maxdepth = int(maxdepth)
...@@ -414,6 +398,18 @@ def TopoDecode(zctx, text): ...@@ -414,6 +398,18 @@ def TopoDecode(zctx, text):
return xbtree.TopoDecode(text, zctx.vdecode) return xbtree.TopoDecode(text, zctx.vdecode)
# xreadlines iterates through lines in r skipping comments.
def xreadlines(r):
while 1:
l = r.readline()
if l == '':
break # EOF
l = l.rstrip() # trim trailing \n
if l.startswith('#'):
continue # skip comments
yield l
@func @func
def cmd_allstructs(argv): def cmd_allstructs(argv):
if len(argv) != 5: if len(argv) != 5:
......
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