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

Adjustment to catch and raise merge conflicts #68

Merged
merged 1 commit into from
Sep 20, 2016

Conversation

jakirkham
Copy link
Member

Fixes #67

This is a tweak to PR ( #55 ), which add the ability to raise merge conflicts. In some cases, it appears that mergeability is indeterminate. If mergeability is undetermined, we wait a little bit and recheck until we get some kind of result. This should avoid some false positives.

pull_request = repo.get_pull(pr_id)
mergeable = None
while mergeable is None:
time.sleep(0.1)
Copy link
Member Author

@jakirkham jakirkham Sep 19, 2016

Choose a reason for hiding this comment

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

Go ahead and sleep to start with. This simplifies the logic of this loop and gives GitHub a chance to compute the mergeability of the PR before we request it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, not sure what a reasonable timeout is between checks, but figured 0.1s would be a good starting place.

Copy link
Member Author

@jakirkham jakirkham Sep 19, 2016

Choose a reason for hiding this comment

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

Should add that mergeable appears to be undefined if the pull request is closed as well. So there is a pretty rare case that could occur where we get here and the pull request is closed. This would result in an infinite loop. We can solve that a couple of ways.

  1. Check whether the PR is still open.
  2. Retry up to some limit.

My preference is to go for 1. Though maybe there is value in doing 2 as well. We would probably want to not have a message in that case. Currently we would get the merge conflict message. Feedback appreciated.

Copy link
Member Author

@jakirkham jakirkham Sep 20, 2016

Choose a reason for hiding this comment

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

We now handle 1. This functionality is also broken out in PR ( #70 ), but had to be merged back into this PR to handle merge conflicts.

@@ -38,7 +43,7 @@ def compute_lint_message(repo_owner, repo_name, pr_id):
sha = str(repo.head.object.hexsha)

# Raise an error if the PR is not mergeable.
if not pull_request.mergeable:
if not mergeable:
Copy link
Member Author

Choose a reason for hiding this comment

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

Switched to using the stored result from our checks for mergeability above.

@jakirkham jakirkham force-pushed the adj_catch_merge_conflicts branch 2 times, most recently from 21842af to 6186ca4 Compare September 20, 2016 00:49
@jakirkham jakirkham mentioned this pull request Sep 20, 2016
time.sleep(0.1)
pull_request = remote_repo.get_pull(pr_id)
if pull_request.state != "open":
return {}
Copy link
Member Author

@jakirkham jakirkham Sep 20, 2016

Choose a reason for hiding this comment

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

Skip linting if the PR turns out to be closed at any point.

@jakirkham
Copy link
Member Author

Merging/deploying so we can get a fix out for this issue ASAP.

@jakirkham jakirkham merged commit 0673a5f into conda-forge:master Sep 20, 2016
@jakirkham jakirkham deleted the adj_catch_merge_conflicts branch September 20, 2016 02:00
@jakirkham
Copy link
Member Author

Please also look over this @pelson to make sure I haven't missed anything or if there are any tweaks you would recommend.

@jakirkham
Copy link
Member Author

Tried to retrigger this issue by closing and reopening PRs (caused the issue somewhat reliably before) and did not encounter it in any of the 8 times this was done with these changes. Think we have done a reasonable job at correcting this issue. Hopefully we don't see it resurface.

@jakirkham
Copy link
Member Author

Also am seeing this triggered correctly when there is a merge conflict.

xref: conda-forge/boost-feedstock#15 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant