Skip to content

Conversation

Manishearth
Copy link
Contributor

Not sure if homu wants this, but we're planning on using this over at Servo.

This basically lets a reviewer say "for the scope of this PR, user is also a reviewer". Which is useful for cases where there are just minor nits left.

state.add_comment(':key: Insufficient privileges')
continue
state.delegate = state.get_repo().pull_request(state.num).user
state.add_comment(':v: @{} can now approve this pull request'.format(state.delegate))
Copy link

Choose a reason for hiding this comment

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

Perhaps add_comment in both delegate= and delegate+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was basically to mirror how r+ <commit> vs r+ works. The one where something is autoselected is where homu reports what was autoselected. I can make it report in the other one too though. shrug

if try_only:
state.add_comment(':key: Insufficient privileges')
continue
state.delegate = state.get_repo().pull_request(state.num).user
Copy link
Owner

Choose a reason for hiding this comment

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

pull_request(...).user returns a User, but it is compared to a plain string in the authentication code above (if username == state.delegate). It would be better to store pull_request(...).user.login instead here, to keep the logic simple.

@Manishearth
Copy link
Contributor Author

Fixed, also added some docs in index.html

continue
state.delegate = state.get_repo().pull_request(state.num).user
state.add_comment(':v: @{} can now approve this pull request'.format(state.delegate))
state.save()
Copy link
Owner

Choose a reason for hiding this comment

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

I generally try to place relevant code together, to reduce mistakes when moving code from here to there. In this aspect, state.save() might be better placed one line above, right after state.delegate = .... Also, it would be better to insert a blank line after state.save().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, also added the delegation message for delegate=

@barosl
Copy link
Owner

barosl commented Nov 11, 2015

This is a very interesting idea. I like the feature overall, and here's a few remaining thoughts:

  1. To make save() work, you should also change the SQL. Namely, (1) the save method itself, (2) CREATE TABLE IF NOT EXISTS pull around line 758, and (3) the state recovery code around line 801.
  2. Would it be better if multiple delegatees could be addressed? It would complicate the logic, so if it's not worth the cost I'm fine with the status quo.

@Manishearth
Copy link
Contributor Author

I'm okay with multiple delegatees. Not sure how to do that wrt the sqlite.

@barosl
Copy link
Owner

barosl commented Nov 11, 2015

Yeah, that was also my concern. All I can think of is to store a JSON array in the field, which is not very elegant. It would be better to land the feature first without adding multiple delegatees, then.

@Manishearth Manishearth force-pushed the delegate branch 2 times, most recently from 146e880 to 6dcdbb2 Compare November 11, 2015 08:59
Run `ALTER TABLE pull ADD delegate TEXT;` on the sqlite db to upgrade

[breaking-change]
barosl added a commit that referenced this pull request Nov 11, 2015
@barosl barosl merged commit 0182354 into barosl:master Nov 11, 2015
@Manishearth Manishearth deleted the delegate branch November 11, 2015 09:20
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.

3 participants