[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51200] trunk/blender/intern/tools/ credits_svn_gen.py: update to credits generator

Campbell Barton ideasman42 at gmail.com
Tue Oct 9 03:42:45 CEST 2012


Revision: 51200
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51200
Author:   campbellbarton
Date:     2012-10-09 01:42:41 +0000 (Tue, 09 Oct 2012)
Log Message:
-----------
update to credits generator 

Modified Paths:
--------------
    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-10-09 01:07:08 UTC (rev 51199)
+++ trunk/blender/intern/tools/credits_svn_gen.py	2012-10-09 01:42:41 UTC (rev 51200)
@@ -49,9 +49,9 @@
 
 Example execution commands:
 
-   svn log https://svn.blender.org/svnroot/bf-blender/trunk/blender -v --xml > ~/svn_log.xml
+   svn log https://svn.blender.org/svnroot/bf-blender/trunk/blender -v --xml > ~/svn_log_bfb.xml
    svn log https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons -v --xml > ~/svn_log_ext.xml
-   python3.2 intern/tools/credits_svn_gen.py --svn_log=~/svn_log.xml --svn_log_ext=~/svn_log_ext.xml --tracker_csv=~/tracker_report-2012-10-03.csv
+   python3.2 intern/tools/credits_svn_gen.py --svn_log_bfb=~/svn_log.xml --svn_log_ext=~/svn_log_ext.xml --tracker_csv=~/tracker_report-2012-10-03.csv
 """
 
 # -----------------------------------------------------------------------------
@@ -167,6 +167,7 @@
     "cessen": "Nathan Vegdahl",
     "cmccad": "Casey Corn",
     "damien78": "Damien Plisson",
+    "damir": "Damir Prebeg",
     "desoto": "Chris Burt",
     "dfelinto": "Dalai Felinto",
     "dingto": "Thomas Dinges",
@@ -254,6 +255,7 @@
     "scourage": "Robert Holcomb",
     "sergof": "Sergej Reich",
     "sgefant": "Stefan Gartner",
+    "shul": "Shaul Kedem",
     "sirdude": "Kent Mein",
     "smerch": "Alex Sytnik",
     "snailrose": "Charlie Carley",
@@ -319,6 +321,7 @@
     "testscreenings": "Florian Meyer",
     "tetron": "Peter Amstutz",
     "thomasl": "Thomas Larsson",
+    "vencax": "Vaclav Klecanda",
     "venomgfx": "Pablo Vazquez",
     "wiseman303": "Adam Wiseman",
     }
@@ -344,16 +347,15 @@
 
 # ----------------------------------------------------------------------------
 # Since we cant detect some authors to credits, store spesific revisions
-author_overrides = {
+author_overrides_bfb = {
     "farny": (43567, 44698),
+    "damir": (37043, 40311, 44550, 45295),
     }
 
+author_overrides_ext = {
+    "vencax": (30897, ),
+    }
 
-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.
@@ -459,19 +461,20 @@
                 return False
         return True
 
-    tot_valid = 0
+    has_valid_path = False
     for action, path in commit.paths:
         if is_path_valid(path):
-            tot_valid += 1
+            has_valid_path = True
+            break
 
-    if tot_valid == 0:
+    if not has_valid_path:
         return False
 
     # couldnt prove invalid, must be valid
     return True
 
 
-def main_credits(min_rev=0, min_rev_ext=0):
+def main_credits(min_rev_bfb=0, min_rev_ext=0):
 
     # ------------------------------------------------------------------------
     # Parse Args
@@ -484,7 +487,7 @@
     "Run Script: %s [options]" % os.path.basename(__file__))
 
     parser = argparse.ArgumentParser(description=usage_text)
-    parser.add_argument("-s", "--svn_log", dest="svn_log",
+    parser.add_argument("-s", "--svn_log_bfb", dest="svn_log_bfb",
             metavar='FILE', required=True,
             help="File path pointing to svn log, "
                  "generated by 'svn log . -v --xml'")
@@ -499,21 +502,28 @@
     args = parser.parse_args(sys.argv[1:])
 
     tracker_csv = args.tracker_csv
-    svn_log = args.svn_log
+    svn_log_bfb = args.svn_log_bfb
     svn_log_ext = args.svn_log_ext
 
     # ------------------------------------------------------------------------
     # Main Logic
 
+    # bf-blender only
     patch_map = build_patch_name_map(tracker_csv)
 
-    commits = (parse_commits(svn_log, min_rev=min_rev) +
-               parse_commits(svn_log_ext, min_rev=min_rev_ext))
-
     credits = {key: Credit() for key in author_name_mapping}
 
-    for commit in commits:
-        if is_credit_commit_valid(commit):
+    def commit_to_credit(commits, author_overrides):
+        print(len(commits))
+        author_overrides_reverse = {
+            revision: author
+            for author, revisions in author_overrides.items()
+            for revision in revisions}
+
+        for commit in commits:            
+            if not is_credit_commit_valid(commit):
+                continue
+
             patch_id, patch_author = patch_find_author(commit, patch_map)
 
             if patch_author is None:
@@ -522,6 +532,7 @@
                                                       commit.author)
                 credit = credits.get(author)
                 if credit is None:
+                    
                     if commit.author not in alert_users:
                         print("warning: '%s' is not in "
                               "'author_name_mapping' !" % commit.author)
@@ -549,14 +560,27 @@
 
             credit.commits.append(commit)
 
+
+    for (commits, author_overrides) in (
+             (parse_commits(svn_log_bfb, min_rev=min_rev_bfb),
+              author_overrides_bfb),
+
+             (parse_commits(svn_log_ext, min_rev=min_rev_ext),
+              author_overrides_ext)):
+        
+        commit_to_credit(commits, author_overrides)
+    del commits, author_overrides
+
     # write out the wiki page
     # sort by name
-    is_main_credits = (min_rev == 0 and min_rev_ext == 0)
+    is_main_credits = (min_rev_bfb == 0 and min_rev_ext == 0)
+    print(min_rev_bfb, min_rev_ext)
     if is_main_credits:
         filename = "credits.html"
     else:
         filename = "credits_release.html"
-
+    
+    
     file = open(filename, 'w', encoding="utf-8")
 
     file.write("<h3>Individual Contributors</h3>\n\n")
@@ -610,6 +634,7 @@
 
     file.write("\n\n")
 
+
     # -------------------------------------------------------------------------
     # Companies, hard coded
     if is_main_credits:
@@ -631,7 +656,7 @@
 
 def main():
     main_credits()
-    main_credits(min_rev=46461, min_rev_ext=3355)
+    main_credits(min_rev_bfb=46461, min_rev_ext=3355)
 
 if __name__ == "__main__":
     main()




More information about the Bf-blender-cvs mailing list