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

build: improve patch filename remembering #23070

Merged
merged 1 commit into from Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion script/lib/patches.py
Expand Up @@ -8,11 +8,13 @@ def read_patch(patch_dir, patch_filename):
"""Read a patch from |patch_dir/filename| and amend the commit message with
metadata about the patch file it came from."""
ret = []
added_filename_line = False
patch_path = os.path.join(patch_dir, patch_filename)
with codecs.open(patch_path, encoding='utf-8') as f:
for l in f.readlines():
if l.startswith('diff -'):
if not added_filename_line and (l.startswith('diff -') or l.startswith('---')):
ret.append('Patch-Filename: {}\n'.format(patch_filename))
added_filename_line = True
ret.append(l)
return ''.join(ret)

Expand Down