gitdraw/gitdraw.py
gitdraw.pyRaw
1import subprocess
2from datetime import datetime, timedelta
3
4draw = [".aaaa..",
5 "a.....a",
6 "b.b...b",
7 "..c....",
8 ".......",
9 "ccccc.c",
10 ".......",
11 "..ccccc",
12 "d......",
13 "..ddddd",
14 ".......",
15 "ddddddd",
16 "c..c..c",
17 "c.....c",
18 ".......",
19 ".......",
20 ".......",
21 ".......",
22 ".......",
23 "ccccccc",
24 "b..b..b",
25 "b.....b",
26 ".......",
27 "......b",
28 "aaaaaaa",
29 "......b",
30 ".......",
31 "bbbbbbb",
32 "...c...",
33 "ccccccc",
34 ".......",
35 ".......",
36 ".......",
37 ".......",
38 ".......",
39 "ccccccc",
40 "...d..d",
41 "....dd.",
42 ".......",
43 "ddddddd",
44 "c......",
45 "c......",
46 ".......",
47 "bb....b",
48 "b..b..b",
49 "a....aa",
50 ".......",
51 ".......",
52 "......."]
53
54def new_commit(letter, date_str):
55 if letter=='a':
56 intensity = 1
57 elif letter=='b':
58 intensity = 2
59 elif letter=='c':
60 intensity = 3
61 elif letter=='d':
62 intensity = 4
63 else:
64 intensity = 0
65
66 for x in range(intensity):
67 with open("foo.txt", "a") as f:
68 f.write("new line\n")
69
70 basecmd = ["git", "add", "."]
71 subprocess.call(basecmd)
72
73 basecmd = "GIT_AUTHOR_DATE=" + date_str + " GIT_COMMITTER_DATE=" + date_str + " git " + "commit " + "-m " + "'" + date_str + "'"
74 print(basecmd)
75 output = subprocess.check_output(['bash','-c', basecmd])
76 # print(output)
77
78
79
80date = datetime(2017, 8, 13, 10, 00)
81print(date)
82i = 0
83for line in draw:
84 y = list(line)[::-1]
85 print(y)
86 for x in y:
87 print(i)
88 if x!='.':
89 commit_date = date + timedelta(days=i)
90 date_str = commit_date.strftime("%Y-%m-%dT0:0:0")
91 new_commit(x, date_str)
92
93 i +=1