#!/usr/bin/env python from docs import gso import re import sys if "phase1" in sys.argv: st, op = gso("find ./ -type d ! -wholename '*venv*' ! -wholename '*.git*' ! -wholename '*sd*'") assert st == 0 for fn in op.split("\n"): if fn == "./": continue spl = [p for p in fn.split("/") if p not in [".", "./"]] for p in spl: assert re.compile("^\d+$").search(p) or p == "Backlog", "'%s' in %s" % (p, fn) if len(spl) < 2: continue itn = spl[0] tltid = spl[1] if len(spl) > 2: continue # print spl cmd = "git mv %(from)s %(to)s" % {"from": "/".join([itn, tltid]), "to": "./" + tltid} print cmd st, op = gso(cmd) assert st == 0, "returned %s\n%s" % (st, op) # print fn if "test" in sys.argv: st, op = gso("find ./ -type f -iname 'task.org'") assert st == 0
#!/usr/bin/env python from __future__ import print_function from docs import gso import re import sys if 'phase1' in sys.argv: st, op = gso( "find ./ -type d ! -wholename '*venv*' ! -wholename '*.git*' ! -wholename '*sd*'" ) assert st == 0 for fn in op.split('\n'): if fn == './': continue spl = [p for p in fn.split('/') if p not in ['.', './']] for p in spl: assert re.compile('^\d+$').search( p) or p == 'Backlog', "'%s' in %s" % (p, fn) if len(spl) < 2: continue itn = spl[0] tltid = spl[1] if len(spl) > 2: continue #print spl cmd = 'git mv %(from)s %(to)s' % { 'from': '/'.join([itn, tltid]), 'to': './' + tltid } print(cmd) st, op = gso(cmd) assert st == 0, "returned %s\n%s" % (st, op) #print fn
def __init__(self,tc): docs.initvars(cfg) if not os.path.exists(cfg.DATADIR): os.mkdir(cfg.DATADIR) st,op = gso('rm -rf %s/*'%cfg.DATADIR) ; assert st==0 unittest.TestCase.__init__(self,tc)