aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-06-10 16:07:10 +0200
committerMartin Liska <mliska@suse.cz>2020-06-10 16:07:10 +0200
commit50ff02b534195c12298c64311d03a8b2d2dc261f (patch)
tree29d6a412d7b2d28cfc1fa7ac486ac059e419f9a8 /contrib
parent4fed5d5dd85e3f5d812d125f692351646a0417cb (diff)
downloadgcc-50ff02b534195c12298c64311d03a8b2d2dc261f.zip
gcc-50ff02b534195c12298c64311d03a8b2d2dc261f.tar.gz
gcc-50ff02b534195c12298c64311d03a8b2d2dc261f.tar.bz2
gcc-changelog: fix parse_git_name_status for renames.
Renamed files are listed in the following format: M gcc/ada/Makefile.rtl M gcc/ada/impunit.adb R097 gcc/ada/libgnat/s-atopar.adb gcc/ada/libgnat/s-aoinar.adb R095 gcc/ada/libgnat/s-atopar.ads gcc/ada/libgnat/s-aoinar.ads A gcc/ada/libgnat/s-aomoar.adb A gcc/ada/libgnat/s-aomoar.ads So 'R' is followed by a percentage number. contrib/ChangeLog: * gcc-changelog/git_commit.py: Fix renamed files in parse_git_name_status. * gcc-changelog/test_email.py: Add test for it.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/gcc-changelog/git_commit.py2
-rwxr-xr-xcontrib/gcc-changelog/test_email.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index eac6488..e868e02 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -322,7 +322,7 @@ class GitCommit:
t = parts[0]
if t == 'A' or t == 'D' or t == 'M':
modified_files.append((parts[1], t))
- elif t == 'R':
+ elif t.startswith('R'):
modified_files.append((parts[1], 'D'))
modified_files.append((parts[2], 'A'))
return modified_files
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index c50687b..a185b85 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -20,6 +20,8 @@ import os
import tempfile
import unittest
+from git_commit import GitCommit
+
from git_email import GitEmail
import unidiff
@@ -29,6 +31,12 @@ script_path = os.path.dirname(os.path.realpath(__file__))
unidiff_supports_renaming = hasattr(unidiff.PatchedFile(), 'is_rename')
+NAME_STATUS1 = """
+M gcc/ada/impunit.adb'
+R097 gcc/ada/libgnat/s-atopar.adb gcc/ada/libgnat/s-aoinar.adb
+"""
+
+
class TestGccChangelog(unittest.TestCase):
def setUp(self):
self.patches = {}
@@ -337,3 +345,9 @@ class TestGccChangelog(unittest.TestCase):
email = self.from_patch_glob('0001-configure.patch')
assert not email.errors
assert len(email.changelog_entries) == 2
+
+ def test_parse_git_name_status(self):
+ modified_files = GitCommit.parse_git_name_status(NAME_STATUS1)
+ assert len(modified_files) == 3
+ assert modified_files[1] == ('gcc/ada/libgnat/s-atopar.adb', 'D')
+ assert modified_files[2] == ('gcc/ada/libgnat/s-aoinar.adb', 'A')