From cbe4d9322fe2f9040e78dd03e92b0a4b2fd27ef3 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 22 Dec 2017 10:01:54 -0800 Subject: [PATCH] reviewkeys: add 'message' parameter Add 'message' optional parameter to reviewkeys which can be use to have a shortcut to leave recheck in reviews (example of use case). reviewkeys: - key: 'meta 4' approvals: [] message: 'recheck' It updates the doc and also the openstack-gertty.yaml since it can be useful for all OpenStack reviewers. Change-Id: I81f3cc8374fe1872efb71d4b2bc1c647b118d43f --- doc/source/configuration.rst | 11 +++++++++-- examples/openstack-gertty.yaml | 3 +++ gertty/config.py | 1 + gertty/view/change.py | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst index 56e7718..dd1699d 100644 --- a/doc/source/configuration.rst +++ b/doc/source/configuration.rst @@ -380,12 +380,16 @@ Reviewkeys appear in the help text for the change screen. **value** The value for this approval. + **message** + Optional, it can be used to include a message during the review. + **submit** Set this to `true` to instruct Gerrit to submit the change when this reviewkey is activated. -The following example includes a reviewkey that clears all labels, as -well as one that leaves a +1 "Code-Review" approval. +The following example includes a reviewkey that clears all labels, +one that leaves a +1 "Code-Review" approval and another one that +leaves 'recheck' on a review. .. code-block: yaml @@ -396,6 +400,9 @@ well as one that leaves a +1 "Code-Review" approval. approvals: - category: 'Code-Review' value: 1 + - key: 'meta 2' + approvals: [] + message: 'recheck' General Options +++++++++++++++ diff --git a/examples/openstack-gertty.yaml b/examples/openstack-gertty.yaml index 3014bc0..55af548 100644 --- a/examples/openstack-gertty.yaml +++ b/examples/openstack-gertty.yaml @@ -140,3 +140,6 @@ reviewkeys: value: 2 - category: 'Workflow' value: 1 + - key: 'meta 4' + approvals: [] + message: "recheck" diff --git a/gertty/config.py b/gertty/config.py index 4b45cc3..371d44b 100644 --- a/gertty/config.py +++ b/gertty/config.py @@ -93,6 +93,7 @@ class ConfigSchema(object): v.Required('value'): int} reviewkey = {v.Required('approvals'): [reviewkey_approval], + v.Optional('message'): str, 'submit': bool, v.Required('key'): str} diff --git a/gertty/view/change.py b/gertty/view/change.py index 5cebed6..e8f17e8 100644 --- a/gertty/view/change.py +++ b/gertty/view/change.py @@ -1155,8 +1155,9 @@ class ChangeView(urwid.WidgetWrap): self.app.log.debug("Reviewkey %s with approvals %s" % (reviewkey['key'], approvals)) row = self.revision_rows[self.last_revision_key] + message = reviewkey.get('message', '') submit = reviewkey.get('submit', False) - self.saveReview(row.revision_key, approvals, '', True, submit) + self.saveReview(row.revision_key, approvals, message, True, submit) def saveReview(self, revision_key, approvals, message, upload, submit): message_keys = self.app.saveReviews([revision_key], approvals,