forked from devanshds/Git-commit-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitbot.py
More file actions
51 lines (43 loc) · 1.28 KB
/
commitbot.py
File metadata and controls
51 lines (43 loc) · 1.28 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
Add progressbar2 and also make the function more modular.
Add tkinter gui as well and add date time change options.
Add descriptions on commandline and package the entire thing
Lets see where we can take this.
P.S. Made by Devansh.
"""
from time import sleep
import os
count=1
def update():
if 'a.txt' in os.listdir():
os.system('rename a.txt b.txt') #Renames file
elif 'b.txt' in os.listdir():
os.system('rename b.txt a.txt') #Renames file
else:
listdir=os.listdir()
for list in listdir:
if list != '.git':
os.system('del '+ list)
os.system('type nul > a.txt')
def pull(repo,url):
if os.path.exists(repo)==False:
os.system('git clone ' + url)
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, ''+repo)
os.chdir(filename)
def push():
global count
os.system('cd')
os.system('git add . && git commit -m "commit ' + str(count) + '"')
os.system('git push origin master')
count+=1
def main():
repo=input("Enter Git Repository name: ")
url = input("Enter Git Repository URL: ")
comm=int(input("Enter Number Of Commits To Perform: "))
pull(repo,url)
for i in range(0,comm):
update()
push()
if __name__=='__main__':
main()