Skip to content

Commit

Permalink
Merge branch 'main' into 312-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ezio-melotti committed Oct 1, 2023
2 parents cbbf993 + e202e2e commit f42f840
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r requirements.txt
coverage
pytest==7.4.0
pytest==7.4.2
pytest-asyncio==0.21.1
pytest-aiohttp==1.0.4
pytest-aiohttp==1.0.5
pytest-cov==4.1.0
45 changes: 24 additions & 21 deletions miss_islington/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

@app.task()
def setup_cpython_repo():
print("Setting up CPython repository") # pragma: nocover
print("Setting up CPython repository") # pragma: nocover
if "cpython" not in os.listdir("."):
subprocess.check_output(
f"git clone https://{os.environ.get('GH_AUTH')}:x-oauth-basic@github.com/miss-islington/cpython.git".split()
Expand Down Expand Up @@ -91,15 +91,16 @@ async def backport_task_asyncio(
await util.comment_on_pr(
gh,
issue_number,
f"""{util.get_participants(created_by, merged_by)}, I can't backport for now. Please try again later or
backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""",
f"""\
{util.get_participants(created_by, merged_by)}, I can't backport for now. Please try again later or
backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)

# Ensure that we don't have any changes lying around
subprocess.check_output(['git', 'reset', '--hard'])
subprocess.check_output(['git', 'clean', '-fxd'])
Expand All @@ -117,26 +118,28 @@ async def backport_task_asyncio(
await util.comment_on_pr(
gh,
issue_number,
f"""Sorry {util.get_participants(created_by, merged_by)}, I had trouble checking out the `{branch}` backport branch.
Please retry by removing and re-adding the "needs backport to {branch}" label.
Alternatively, you can backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on the command line.
```
cherry_picker {commit_hash} {branch}
```
""",
f"""\
Sorry {util.get_participants(created_by, merged_by)}, I had trouble checking out the `{branch}` backport branch.
Please retry by removing and re-adding the "needs backport to {branch}" label.
Alternatively, you can backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on the command line.
```
cherry_picker {commit_hash} {branch}
```
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
cp.abort_cherry_pick()
except cherry_picker.CherryPickException:
await util.comment_on_pr(
gh,
issue_number,
f"""Sorry, {util.get_participants(created_by, merged_by)}, I could not cleanly backport this to `{branch}` due to a conflict.
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""",
f"""\
Sorry, {util.get_participants(created_by, merged_by)}, I could not cleanly backport this to `{branch}` due to a conflict.
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""",
)
await util.assign_pr_to_core_dev(gh, issue_number, merged_by)
cp.abort_cherry_pick()
Expand Down
7 changes: 2 additions & 5 deletions miss_islington/util.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import re
import subprocess

import gidgethub

import textwrap


async def comment_on_pr(gh, issue_number, message):
"""
Leave a comment on a PR/Issue
"""
issue_comment_url = f"/repos/python/cpython/issues/{issue_number}/comments"
message = textwrap.dedent(message)
data = {"body": message}
response = await gh.post(issue_comment_url, data=data)
print(f"Commented at {response['html_url']}, message: {message}")
Expand Down Expand Up @@ -79,4 +77,3 @@ def normalize_title(title, body):
else:
# Being paranoid in case \r\n is used.
return title[:-1] + body[1:].partition("\r\n")[0]

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ git+https://github.com/python/cherry-picker.git@main#egg=cherry_picker
aiohttp==3.8.5
gidgethub==5.3.0
cachetools==5.3.1
redis==5.0.0
redis==5.0.1
celery==5.3.4
sentry-sdk==1.30.0
sentry-sdk==1.31.0
click==8.1.7

# workaround for celery/kombu#1600
Expand Down

0 comments on commit f42f840

Please sign in to comment.