You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
1.9 KiB

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