-
Notifications
You must be signed in to change notification settings - Fork 1
/
committer.py
31 lines (28 loc) · 1.11 KB
/
committer.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
import os
import platform
import subprocess
from datetime import datetime
from datetime import date
from datetime import timedelta
import random
def calling(git_date=datetime(2016,11,14,19,53,41)):
changes = ["LeetCode #10"]
element = random.choice(changes)
#subprocess.call("")
#subprocess.call("git --version")
#subprocess.call("git status")
print(platform.system())
subprocess.Popen(['git', 'add', 'src/leetcode/solutions/InsertIntervals.java'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
os.environ["GIT_COMMITTER_DATE"] = str(git_date)
os.environ["GIT_AUTHOR_DATE"] = str(git_date)
subprocess.Popen(['git', 'commit', '-am', '\"' + str(element) + '\"', '--date=' + str(git_date)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subprocess.Popen(['git', 'push', 'origin', 'master'],stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(os.environ["GIT_COMMITTER_DATE"])
print(os.environ["GIT_AUTHOR_DATE"])
del os.environ["GIT_COMMITTER_DATE"]
del os.environ["GIT_AUTHOR_DATE"]
print("Calling")
def main():
calling()
if __name__ == "__main__":
main()