Commit d719ee18 authored by Kirill Smelkov's avatar Kirill Smelkov

.

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