[PATCH] git-backport: support renamed .cc files in commit message.
Bernhard Reutner-Fischer
rep.dot.nop@gmail.com
Fri Jan 14 07:44:18 GMT 2022
On Wed, 12 Jan 2022 16:54:46 +0100
Martin Liška <mliska@suse.cz> wrote:
> +def replace_file_in_changelog(lines, filename):
> + if not filename.endswith('.cc'):
> + return
> +
> + # consider all componenets of a path: gcc/ipa-icf.cc
> + while filename:
> + for i, line in enumerate(lines):
> + if filename in line:
> + line = line.replace(filename, filename[:-1])
> + lines[i] = line
> + return
> + parts = filename.split('/')
> + if len(parts) == 1:
> + return
> + filename = '/'.join(parts[1:])
> +
I think you mean os.sep instead of the hardcoded slash.
But i'd use os.path.split and os.path.join
thanks,
More information about the Fortran
mailing list