changeset d252eb26af3c in tryton-tools:default
details: https://hg.tryton.org/tryton-tools?cmd=changeset&node=d252eb26af3c
description:
Fetch patch and store it before applying with mercurial
When mercurial has to fetch the patch, it may fail to apply it.
diffstat:
reviewbot.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diffs (19 lines):
diff -r 0e6703a75db0 -r d252eb26af3c reviewbot.py
--- a/reviewbot.py Mon May 02 23:04:58 2022 +0200
+++ b/reviewbot.py Mon Sep 12 14:48:50 2022 +0200
@@ -69,9 +69,14 @@
def patch_repository(session, repo_dir, issue_id, patchset):
patch_url = (CODEREVIEW_URL
+ '/'.join(['', 'download', 'issue%s_%s.diff' % (issue_id, patchset)]))
+ with urllib.request.urlopen(patch_url) as response:
+ with tempfile.NamedTemporaryFile(delete=False) as patch_file:
+ shutil.copyfileobj(response, patch_file)
subprocess.check_call(
- ['hg', 'import', '-q', '--cwd', repo_dir, '--no-commit', patch_url],
+ ['hg', 'import', '-q', '--cwd', repo_dir, '--no-commit',
+ patch_file.name],
stderr=subprocess.DEVNULL)
+ os.unlink(patch_file.name)
# Run status to create new subrepo
subprocess.check_call(
['hg', 'status', '-q', '--subrepos', '--cwd', repo_dir],