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
This commit is contained in:
Chris Dent 2016-03-07 14:23:19 +00:00
parent 9aa075a2e3
commit 7b4c8ddaf5
1 changed files with 5 additions and 1 deletions

View File

@ -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))