From 7b4c8ddaf5940a5d3635355dee24ff5f66001337 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Mon, 7 Mar 2016 14:23:19 +0000 Subject: [PATCH] Fix some issues in add-reviewers * Deal with utf-8 in human names. To avoid requiring six, just check the python version. * Allow the review identifier to be a commit hash instead just a review int as there can be conflicts: https://code.google.com/p/gerrit/issues/detail?id=1707 Change-Id: Ie89dfd7212f72355ab00c0c8dc9edf07f686488b --- tools/add-reviewers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/add-reviewers.py b/tools/add-reviewers.py index 7b0afe0..2e16de5 100755 --- a/tools/add-reviewers.py +++ b/tools/add-reviewers.py @@ -4,6 +4,7 @@ import argparse import json import logging import subprocess +import sys logger = logging.getLogger(__name__) @@ -14,7 +15,7 @@ def parse_args(): parser.add_argument('--debug', help="Print debugging information", action='store_true') parser.add_argument("username", help="Your Gerrit username", type=str) - parser.add_argument("review", help="An API WG Gerrit review", type=int) + parser.add_argument("review", help="An API WG Gerrit review", type=str) args = parser.parse_args() return (args.debug, args.username, args.review) @@ -38,6 +39,9 @@ def add_reviewers(debug, username, liaisons, review): ] for liaison in liaisons: + # Hack to avoid six + if sys.version_info.major < 3: + liaison = liaison.encode('utf-8') gerrit.append('--add "{}"'.format(liaison)) gerrit.append('{}'.format(review))