You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2015/07/19 01:56:26 UTC
svn commit: r1691785 [3/3] - in /comdev/reporter.apache.org/trunk:
scandist_test.dat scandist_test.py
Added: comdev/reporter.apache.org/trunk/scandist_test.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scandist_test.py?rev=1691785&view=auto
==============================================================================
--- comdev/reporter.apache.org/trunk/scandist_test.py (added)
+++ comdev/reporter.apache.org/trunk/scandist_test.py Sat Jul 18 23:56:25 2015
@@ -0,0 +1,55 @@
+"""
+Simple test harness
+
+Reads output from svnpubsub/wacher.py (or similar)
+Input is parsed by scandist.processTargets()
+
+If a sufficient gap occurs between commits, then
+the parsed data is passed to scandist.processCommit()
+
+TODO: needs to check the output somehow
+
+"""
+
+import scandist
+import json
+import ast
+import datetime
+
+def processBatch():
+ for project in scandist.targets:
+ # show what is to be processed
+ print "Batch: <<",project,
+ committers = scandist.targets[project]
+ for committer in committers:
+ print committer,
+ for entry in committers[committer]:
+ print entry['id'],
+ print ">>"
+ scandist.processTargets()
+
+if __name__ == "__main__":
+ prevdate=None
+ scandist.sendEmail = False
+ #scandist.trace = True
+ with open("scandist_test.dat") as data:
+ inCommit = False
+ for line in data:
+ if inCommit:
+ chunk += line
+ if line.startswith("COMMIT:"):
+ inCommit = True
+ chunk=""
+ elif line.endswith("}\n"):
+ inCommit = False
+ commit = ast.literal_eval(chunk)
+ rawDate = commit['date'][:19] # drop the unparseable part (unnecessary for diffs anyway)
+ date=datetime.datetime.strptime(rawDate,"%Y-%m-%d %H:%M:%S")# does not seem to support %z??
+ if not prevdate == None:
+ diffSecs = (date - prevdate).seconds
+ if diffSecs > 90:
+ processBatch()
+ prevdate = date
+ scandist.processCommit(commit)
+
+ processBatch() # process any trailing data
\ No newline at end of file
Propchange: comdev/reporter.apache.org/trunk/scandist_test.py
------------------------------------------------------------------------------
svn:eol-style = native