]> git.ipfire.org Git - thirdparty/gcc.git/commit
gcc-changelog: enhance handling of renamings
authorPierre-Marie de Rodat <derodat@adacore.com>
Wed, 27 May 2020 13:25:18 +0000 (15:25 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 28 May 2020 09:14:44 +0000 (11:14 +0200)
commita634157de1e83536123412b02aae184a9d590751
tree83dacc81f1e29dd65201200026944480c3917813
parent48e872db11b27604f4993f9be8f67f40b1a40468
gcc-changelog: enhance handling of renamings

So far, we expect from a commit that renames a file to contain a
changelog entry only for the new name. For example, after the following
commit:

   $ git move foo bar
   $ git commit

We expect the following changelog:

   * bar: Renamed from foo.

Git does not keep track of renamings, only file deletions and additions.
The display of patches then uses heuristics (with config-dependent
parameters) to try to match deleted and added files in the same commit.
It is thus brittle to rely on this information.

This commit modifies changelog processing so that renames are considered
as a deletion of a file plus an addition of another file. The following
changelog is now expected for the above example:

   * foo: Move...
   * bar: Here.

contrib/

* gcc-changelog/git_email.py (GitEmail.__init__): Interpret file
renamings as a file deletion plus a file addition.
* gcc-changelog/git_repository.py (parse_git_revisions):
Likewise.
* gcc-changelog/test_email.py: New testcase.
* gcc-changelog/test_patches.txt: New testcase.
contrib/gcc-changelog/git_email.py
contrib/gcc-changelog/git_repository.py
contrib/gcc-changelog/test_email.py
contrib/gcc-changelog/test_patches.txt