[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45998] trunk/blender/intern/tools/ credits_svn_gen.py: added attribution overrides for authors, made svn_log and tracker_csv command line arguments.

Campbell Barton ideasman42 at gmail.com
Fri Apr 27 03:38:53 CEST 2012


Revision: 45998
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45998
Author:   campbellbarton
Date:     2012-04-27 01:38:47 +0000 (Fri, 27 Apr 2012)
Log Message:
-----------
added attribution overrides for authors, made svn_log and tracker_csv command line arguments.

Modified Paths:
--------------
    trunk/blender/intern/tools/credits_svn_gen.py

Property Changed:
----------------
    trunk/blender/intern/tools/credits_svn_gen.py

Modified: trunk/blender/intern/tools/credits_svn_gen.py
===================================================================
--- trunk/blender/intern/tools/credits_svn_gen.py	2012-04-26 19:43:25 UTC (rev 45997)
+++ trunk/blender/intern/tools/credits_svn_gen.py	2012-04-27 01:38:47 UTC (rev 45998)
@@ -1,3 +1,5 @@
+#! /usr/bin/env python
+
 # ##### BEGIN GPL LICENSE BLOCK #####
 #
 #  This program is free software; you can redistribute it and/or
@@ -108,10 +110,6 @@
 # -----------------------------------------------------------------------------
 # Special checks to extract the credits
 
-#svn_log = "/dsk/data/src/blender/svn_log_verbose.xml"
-svn_log = "/dsk/data/src/blender/svn_log_verbose.xml"
-tracker_csv = "/l/tracker_report-2011-10-17.csv"
-
 # TODO, there are for sure more companies then are currently listed.
 # 1 liners for in wiki syntax
 contrib_companies = [
@@ -258,8 +256,12 @@
     "xercesblue": "Francisco De La Cruz",
     # TODO, find remaining names
     "nlin": "",
+
+    # added for 'author_overrides'
+    "farny": "Mike Farnsworth",
     }
 
+
 # lame, fill in empty key/values
 empty = []
 for key, value in author_name_mapping.items():
@@ -275,7 +277,18 @@
 for key, value in author_name_mapping.items():
     author_name_mapping_reverse[value] = key
 
+# ----------------------------------------------------------------------------
+# Since we cant detect some authors to credits, store spesific revisions
+author_overrides = {
+    "farny": (43567, 44698),
+    }
 
+
+author_overrides_reverse = {revision: author
+                            for author, revisions in author_overrides.items()
+                            for revision in revisions}
+
+
 def build_patch_name_map(filepath):
     """ Uses the CSV from the patch tracker to build a
         patch <-> author name mapping.
@@ -394,6 +407,34 @@
 
 
 def main():
+
+    # ------------------------------------------------------------------------
+    # Parse Args
+
+    import sys
+    import os
+    import argparse
+
+    usage_text = (
+    "Run Script: %s [options]" % os.path.basename(__file__))
+
+    parser = argparse.ArgumentParser(description=usage_text)
+    parser.add_argument("-s", "--svn_log", dest="svn_log",
+            metavar='FILE', required=True,
+            help="File path pointing to svn log, generated by "
+                 "'svn log . -v --xml'")
+    parser.add_argument("-c", "--tracker_csv", dest="tracker_csv",
+            metavar='FILE', required=True,
+            help="File path pointing to CSV file saved by the patch tracker")
+
+    args = parser.parse_args(sys.argv[1:])
+
+    tracker_csv = args.tracker_csv
+    svn_log = args.svn_log
+
+    # ------------------------------------------------------------------------
+    # Main Logic
+
     patch_map = build_patch_name_map(tracker_csv)
 
     commits = parse_commits(svn_log)
@@ -406,7 +447,9 @@
 
             if patch_author is None:
                 # will error out if we miss adding new devs
-                credit = credits.get(commit.author)
+                author = author_overrides_reverse.get(commit.revision,
+                                                      commit.author)
+                credit = credits.get(author)
                 if credit is None:
                     print("warning: '%s' is not in 'author_name_mapping' !" %
                           commit.author)


Property changes on: trunk/blender/intern/tools/credits_svn_gen.py
___________________________________________________________________
Added: svn:executable
   + *




More information about the Bf-blender-cvs mailing list