Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control who gets notified by GerritStatusPush #2411

Merged
merged 1 commit into from Oct 16, 2016

Conversation

dinatale2
Copy link
Contributor

@dinatale2 dinatale2 commented Sep 23, 2016

Allow the GerritStatusPush object to accept who to notify as an argument. The notify argument is a string
which accepts values found in the gerrit documentation for the --notify flag. The argument is set to None by
default to maintain current functionality.

Signed-off-by: Giuseppe Di Natale dinatale2@llnl.gov

@mention-bot
Copy link

@dinatale2, thanks for your PR! By analyzing the annotation information on this pull request, we identified @tardyp, @adeason and @sa2ajj to be potential reviewers

@codecov-io
Copy link

codecov-io commented Sep 23, 2016

Current coverage is 86.75% (diff: 100%)

Merging #2411 into master will increase coverage by <.01%

@@             master      #2411   diff @@
==========================================
  Files           298        298          
  Lines         30940      30944     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          26842      26846     +4   
  Misses         4098       4098          
  Partials          0          0          

Powered by Codecov. Last update f7be7bc...3945799

@tardyp
Copy link
Member

tardyp commented Sep 23, 2016

Hi we would appreciate some unit tests to test this feature, so that it does not reduce the coverage

@dinatale2 dinatale2 force-pushed the upstream/GerritStatusPush branch 3 times, most recently from b021f07 to edf3837 Compare September 23, 2016 23:21
@@ -175,6 +176,7 @@ def reconfigService(self, server, username, reviewCB=DEFAULT_REVIEW,
self.summaryCB = summaryCB
self.summaryArg = summaryArg
self.builders = builders
self.gerrit_notify = notify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while legacy code extensively uses public members, the new code is expected to be aware whether it's a part of the class' API or not. I'd suggest to use _gerrit_notify

@@ -397,6 +399,10 @@ def sendCodeReview(self, project, revision, result):
return

command = self._gerritCmd("review", "--project %s" % (project,))

if self.gerrit_notify is not None:
command.extend(["--notify %s" % str(self.gerrit_notify)])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you use .extend for a single item? use .append

please use ' not "

@@ -142,7 +142,8 @@ def setUp(self):
def setupGerritStatusPushSimple(self, *args, **kwargs):
serv = kwargs.pop("server", "serv")
username = kwargs.pop("username", "user")
gsp = GerritStatusPush(serv, username, *args, **kwargs)
notify = kwargs.pop("notify", None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto for "


# now test the notify argument
gsp.gerrit_notify = 'OWNER'
gsp.processVersion("2.6", lambda: None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure that all strings that do not include ' use "

Copy link
Contributor Author

@dinatale2 dinatale2 Sep 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a python pro by any means. Do you mind clarifying when to use ' instead of "? For one of the other comments above (in the .extend comment), you suggested I use ' instead of " is why I ask.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, per String Quotes in PEP-8, both " and ' are OK, however it's good to stick to some particular way.

So far, we've been using " for docstrings only """ and ' for all other string literals (some legacy code does not follow this, I must admit).

@dinatale2 dinatale2 force-pushed the upstream/GerritStatusPush branch 3 times, most recently from 1d12236 to ab229f8 Compare September 24, 2016 02:36

# now test the notify argument, even though _gerrit_notify
# is private, work around that
gsp._gerrit_notify = "OWNER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure that you use single quotes everywhere (even in tests).

['ssh', 'user@serv', '-p', '29418', 'gerrit', 'review',
'--project project', '--notify OWNER', "--message 'bla'", '--label Verified=1', 'revision'])

# <=2.5 uses other syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.5 of what?

@dinatale2
Copy link
Contributor Author

I've updated this replacing the " with ' and I've introduced a comment about the different syntax with gerrit versions 2.5 and below. I'm not sure why the bb test failed as well, it appears to have been cancelled.

@tardyp
Copy link
Member

tardyp commented Oct 10, 2016

looks good. There is stil a need for documentation update, and release notes

Copy link
Member

@tardyp tardyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs doc update and relnotes update.
thanks!

@dinatale2
Copy link
Contributor Author

docs and release notes have been updated. Let me know if I need to make any additional changes.

@@ -738,6 +738,7 @@ GerritStatusPush can send a separate review for each build that completes, or a
:param builders: (optional) list of builders to send results for.
This method allows to filter results for a specific set of builder.
By default, or if builders is None, then no filtering is performed.
:param notify: (optional) control who gets notified by Gerrit once the status is posted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would deserve to document which values are possible, probably point on the gerrit documentation, explaining that this correspond to the --notify values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Allow the GerritStatusPush object to accept who to notify
as an argument. The notify argument is a string
which accepts values found in the gerrit documentation
for the --notify flag. The argument is set to None by
default to maintain current functionality.

Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Copy link
Contributor

@sa2ajj sa2ajj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tardyp tardyp merged commit 729c1be into buildbot:master Oct 16, 2016
@dinatale2 dinatale2 deleted the upstream/GerritStatusPush branch October 17, 2016 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants