#! /usr/bin/env python
-"""Takes no arguments. Outputs CSV of what commits people who rejected
-the license were involved in.
+"""whattoremove [arguments]
+
+Flags:
+ -i file File of commits to include
+ -h This help
+
+Outputs CSV list of the commits that people who rejected
+the license were involved in. The exclude file can be
+generated by a command like this:
+ git log --pretty=fomat:%h
"""
import mysql.connector
import datetime, os, re, subprocess, sys, string, random
+import getopt
+
+# Parse JCL
+include = None
+opts, args = getopt.getopt(sys.argv[1:], "hi:")
+for o,a in opts:
+ if o == '-i':
+ f = open(a)
+ include = [ c.strip() for c in f ]
+ f.close()
+ else:
+ print __doc__
+ raise SystemExit
dbconfig = {
'user': 'licensereader',
}
conn = mysql.connector.connect(**dbconfig)
cursor = conn.cursor()
-raw = open("request-approval.txt").read()
# Get those who said no and all the commits the did
q = ( 'SELECT log.cid,users.email FROM log'
cursor.execute(q, (cid,))
for row in cursor:
commit,date,descrip = row
- print '%s, %s, "%s"' % (commit[0:7], emails[cid], descrip)
+ commit = commit[0:7]
+ descrip = descrip.replace('"', '\'')
+ if include == None or commit in include:
+ print '%s, %s, "%s"' % (commit, emails[cid], descrip)