Merge pull request #31765 from ClickHouse/fix_diff_for_backports

Fix diff for backports.
This commit is contained in:
alesapin 2021-11-25 12:01:03 +03:00 committed by GitHub
commit 81942b8128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,8 +100,12 @@ class PRInfo:
self.changed_files = [f['filename'] for f in diff['files']] self.changed_files = [f['filename'] for f in diff['files']]
else: else:
self.changed_files = set([]) self.changed_files = set([])
else:
if 'pr-backport' in self.labels:
diff_url = f"https://github.com/{os.getenv('GITHUB_REPOSITORY')}/compare/master...{self.head_ref}.diff"
else: else:
diff_url = pull_request['diff_url'] diff_url = pull_request['diff_url']
diff = urllib.request.urlopen(diff_url) diff = urllib.request.urlopen(diff_url)
diff_object = PatchSet(diff, diff.headers.get_charsets()[0]) diff_object = PatchSet(diff, diff.headers.get_charsets()[0])
self.changed_files = { f.path for f in diff_object } self.changed_files = { f.path for f in diff_object }