-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathenum.py
50 lines (41 loc) · 1.19 KB
/
enum.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
38
39
40
41
42
43
44
45
46
47
48
49
50
# enum.py
# Reads input file lines and creates git commits based on emails read from input
# When pushed to Github the commit history should show which user is connected to the supplied email
#
# Version: 1.0
# Author: antnks <[email protected]>
# License: public domain
#
# Usage: python enum.oy emails.txt
# Input file is one email per line
# Example:
#
#
import sys
import os
import time
branch = time.time()
print ("Creating a new branch...")
os.system ("git checkout master -b {}".format (branch))
print ("Opening input file {}".format(sys.argv[1]))
fe = open(sys.argv[1], "r")
line = fe.readline()
cnt = 1
while line:
print ("Updating seed file...")
fs = open ("seed.txt", "w")
fs.write (str(cnt))
fs.close()
print ("Changing git repo author to {} {}".format(cnt, line.strip()))
os.system ("git add seed.txt")
os.system ("git config user.name {}".format(cnt))
os.system ("git config user.email {}".format(line.strip()))
print ("Commiting...")
os.system ("git commit -a -m {}".format(cnt))
line = fe.readline()
cnt += 1
fe.close()
print ("Pushing to Github...")
os.system ("git push origin {}".format(branch))