-
Notifications
You must be signed in to change notification settings - Fork 0
/
noiterations.py
37 lines (34 loc) · 1.28 KB
/
noiterations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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
if 'test' in sys.argv:
st,op = gso("find ./ -type f -iname 'task.org'") ; assert st==0
for fn in op.split('\n'):
spl = fn.split('/')[1:]
if spl[0]==spl[1]:
print('git mv %(fr)s %(to)s'%{'fr':spl[0]+'/'+spl[0]+'/*','to':spl[0]+'/'})
if 'iterations' in sys.argv:
st,op = gso("find ./ -type f -iname 'iteration.org'"); assert st==0
for fn in op.split('\n'):
itn = fn.split('/')[1]
#print itn,fn
print('git mv %s %s'%(fn,'iterations/'+itn+'.org'))