diff options
Diffstat (limited to 'pygerrit')
-rw-r--r-- | pygerrit/rest/__init__.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/pygerrit/rest/__init__.py b/pygerrit/rest/__init__.py index 31e5b3e..49cc434 100644 --- a/pygerrit/rest/__init__.py +++ b/pygerrit/rest/__init__.py @@ -248,15 +248,29 @@ class GerritReview(object): 'line': 10, 'message': 'inline message'}]) + add_comments([{'filename': 'Makefile', + 'range': {'start_line': 0, + 'start_character': 1, + 'end_line': 0, + 'end_character': 5}, + 'message': 'inline message'}]) + """ for comment in comments: - if 'filename' and 'line' and 'message' in comment.keys(): - line_msg = {"line": comment['line'], - "message": comment['message']} - file_comment = {comment['filename']: [line_msg]} + if 'filename' and 'message' in comment.keys(): + msg = {} + if 'range' in comment.keys(): + msg = {"range": comment['range'], + "message": comment['message']} + elif 'line' in comment.keys(): + msg = {"line": comment['line'], + "message": comment['message']} + else: + continue + file_comment = {comment['filename']: [msg]} if self.comments: if comment['filename'] in self.comments.keys(): - self.comments[comment['filename']].append(line_msg) + self.comments[comment['filename']].append(msg) else: self.comments.update(file_comment) else: |