Skip to content
Snippets Groups Projects
  • Pierre-Marie de Rodat's avatar
    a634157d
    gcc-changelog: enhance handling of renamings · a634157d
    Pierre-Marie de Rodat authored
    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.
    a634157d
    History
    gcc-changelog: enhance handling of renamings
    Pierre-Marie de Rodat authored
    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.