[Libreoffice-commits] dev-tools.git: scripts/esc-mentoring.py

jan i jani at Mac-0c4de9c2f7c7.local
Fri Feb 12 10:27:28 UTC 2016


 scripts/esc-mentoring.py |   67 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

New commits:
commit fe62f528cde3c69c07d02c801afa03b93877a746
Author: jan i <jani at Mac-0c4de9c2f7c7.local>
Date:   Fri Feb 12 11:14:52 2016 +0100

    added mentoring tool (start version).
    
    This tool serves 2 purposes:
    - generate a report to ESC
    - provide daily "what to do" on gerrit/BZ regarding non-committers.
    
    Script reads all open easyHacks and provides analytics
    Script reads all gerrit patch from non committers and provices analytics

diff --git a/scripts/esc-mentoring.py b/scripts/esc-mentoring.py
new file mode 100644
index 0000000..16dfe36
--- /dev/null
+++ b/scripts/esc-mentoring.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python3
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+import sys
+#import re
+#import sh
+from urllib.request import urlopen, URLError
+from io import BytesIO
+
+def get_easyHacks():
+    url = 'https://bugs.documentfoundation.org/buglist.cgi?' \
+          'bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&bug_status=NEEDINFO' \
+          '&columnlist=assigned_to%2Cbug_status%2Cshort_desc%2Cchangeddate%2Creporter%2Cbug_id%2Clongdescs.count%2Copendate' \
+          '&keywords=easyHack%2C%20' \
+          '&keywords_type=allwords' \
+          '&query_format=advanced' \
+          '&resolution=---' \
+          '&ctype=csv' \
+          '&human=0'
+    try:
+        resp = urlopen(url)
+    except URLError:
+        sys.stderr.write('Error fetching {}'.format(url))
+        sys.exit(1)
+    bug_ids=[]
+    for line in [raw.decode('utf-8').strip('\n') for raw in BytesIO(resp.read())][1:]:
+        bug_ids.append(line)
+    return bug_ids
+
+
+def print_counts(counts):
+    printorder = reversed(sorted((count, name) for (name, count) in counts.items()))
+    for count in printorder:
+        print('%5d %s' % (count[0], count[1]))
+
+if __name__ == '__main__':
+    fixed_regression_ids = get_easyHacks()
+    sys.stderr.write('found %d fixed regressions: %s\n' % (len(fixed_regression_ids), fixed_regression_ids))
+#    for bug_id in fixed_regression_ids:
+#        sys.stderr.write('working on bug %d\n' % bug_id)
+#        # FIXME: use --numstat instead, which does not abbreviate filenames
+#        logstat = sh.git('--no-pager', 'log', '--grep', '[fdo|tdf]#%d' % bug_id, '--stat')
+#        for line in logstat:
+#            match = statregex.search(str(line))
+#            if match and match.group(1):
+#                filename = match.group(1)
+#                sys.stderr.write('regression fix touched file: %s\n' % filename)
+#                if filename in file_counts:
+#                    file_counts[filename]+=1
+#                else:
+#                    file_counts[filename]=1
+#    print('top level dirs:')
+#    print_counts(get_dir_counts(file_counts, 1))
+#    print('\nsecond level dirs:')
+#    print_counts(get_dir_counts(file_counts, 2))
+#    print('\nthird level dirs:')
+#    print_counts(get_dir_counts(file_counts, 3))
+#    print('\nfourth level dirs:')
+#    print_counts(get_dir_counts(file_counts, 4))
+#    print('\nfiles:')
+#    print_counts(file_counts)


More information about the Libreoffice-commits mailing list