[Libreoffice-commits] dev-tools.git: esc-reporting/esc-automate.py
jan Iversen
jani at libreoffice.org
Sun May 14 10:18:10 UTC 2017
esc-reporting/esc-automate.py | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
New commits:
commit cf3064118e8b9488246919fc23e9f4b66910271f
Author: jan Iversen <jani at libreoffice.org>
Date: Sun May 14 12:17:47 2017 +0200
esc-report, added support for gerrit commenting
diff --git a/esc-reporting/esc-automate.py b/esc-reporting/esc-automate.py
index 3b9d38f..f6a67c5 100755
--- a/esc-reporting/esc-automate.py
+++ b/esc-reporting/esc-automate.py
@@ -26,6 +26,8 @@ import os
import datetime
import json
import requests
+from requests.auth import HTTPDigestAuth
+
def util_load_data_file(fileName):
@@ -76,6 +78,16 @@ def doBugzilla(id, command, isComment=False):
+def doGerrit(id, command):
+ global cfg
+
+ url = 'https://gerrit.libreoffice.org/a/changes/' + id
+ r = requests.post(url, None, command, auth=HTTPDigestAuth(cfg['gerrit']['user'], cfg['gerrit']['password']))
+ rawData = json.loads(r.text[5:])
+ r.close()
+
+
+
def doMail(mail, subject, content, attach=None):
if attach:
attach = '-a ' + attach + ' '
@@ -92,14 +104,14 @@ def handle_gerrit_abandon(id, text):
-def handle_gerrit_comment(id, text):
- # handle_gerrit_comment(id, 'A polite ping, ' + cfg['automate']['gerrit']['comment'])
- return
+def handle_gerrit_review(id, email):
+ doGerrit(id + '/reviewers', '{"reviewer": "' + email + '"}')
-def handle_gerrit_review(id, email):
- return
+def handle_gerrit_comment(id, text):
+ polite = 'A polite ping, ' + cfg['automate']['gerrit']['comment']
+ doGerrit(id + '/revisions/current/review', polite)
@@ -107,7 +119,6 @@ def handle_bugzilla_unassign(id, text):
handle_bugzilla_reset_user(id, text)
handle_bugzilla_reset_status(id, text)
handle_bugzilla_comment(id, text, isPolite=False)
- return
@@ -223,9 +234,10 @@ def runAutomate():
fp.close()
#JIX executeLoop(handle_gerrit_abandon, 'gerrit', 'to_abandon_abandon')
- #JIX executeLoop(handle_gerrit_comment, 'gerrit', 'to_abandon_comment')
#JIX executeLoop(handle_gerrit_review, 'gerrit', 'to_review')
+ executeLoop(handle_gerrit_comment, 'gerrit', 'to_abandon_comment')
+
executeLoop(handle_bugzilla_unassign, 'bugzilla', 'to_unassign_unassign')
executeLoop(handle_bugzilla_comment, 'bugzilla', 'to_unassign_comment')
executeLoop(handle_bugzilla_reset_status, 'bugzilla', 'assign_problem_status')
More information about the Libreoffice-commits
mailing list