[gcc(refs/users/guojiufu/heads/guojiufu-branch)] Use commit timestamp in git_update_version.py.

Jiu Fu Guo guojiufu@gcc.gnu.org
Wed Jun 10 02:57:42 GMT 2020


https://gcc.gnu.org/g:4a5d072ad97d7d4fd003efff953a6202afd176a0

commit 4a5d072ad97d7d4fd003efff953a6202afd176a0
Author: Martin Liska <mliska@suse.cz>
Date:   Tue May 19 21:16:10 2020 +0200

    Use commit timestamp in git_update_version.py.
    
            * gcc-changelog/git_commit.py: Add param use_commit_ts
            for to_changelog_entries.
            * gcc-changelog/git_update_version.py: Se use_commit_ts to True.

Diff:
---
 contrib/ChangeLog                           | 6 ++++++
 contrib/gcc-changelog/git_commit.py         | 4 ++--
 contrib/gcc-changelog/git_update_version.py | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 5ef08f41a92..f3de87b43d9 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-19  Martin Liska  <mliska@suse.cz>
+
+	* gcc-changelog/git_commit.py: Add param use_commit_ts
+	for to_changelog_entries.
+	* gcc-changelog/git_update_version.py: Se use_commit_ts to True.
+
 2020-05-19  Martin Liska  <mliska@suse.cz>
 
 	* mklog.py: Skip GTY for struct names.  Make flake8 happy.
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 5214cc36538..f6b9c5b1586 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -500,11 +500,11 @@ class GitCommit:
                     err = Error(msg % (entry.folder, changelog_location), file)
                     self.errors.append(err)
 
-    def to_changelog_entries(self):
+    def to_changelog_entries(self, use_commit_ts=False):
         for entry in self.changelog_entries:
             output = ''
             timestamp = entry.datetime
-            if not timestamp:
+            if not timestamp or use_commit_ts:
                 timestamp = self.date.strftime('%Y-%m-%d')
             authors = entry.authors if entry.authors else [self.author]
             # add Co-Authored-By authors to all ChangeLog entries
diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index 2de44f27580..f38e011df45 100755
--- a/contrib/gcc-changelog/git_update_version.py
+++ b/contrib/gcc-changelog/git_update_version.py
@@ -38,7 +38,7 @@ def prepend_to_changelog_files(repo, folder, git_commit):
             print(error)
         # TODO: add error message
         return
-    for entry, output in git_commit.to_changelog_entries():
+    for entry, output in git_commit.to_changelog_entries(use_commit_ts=True):
         # TODO
         full_path = os.path.join(folder, entry, 'ChangeLog.test')
         print('writting to %s' % full_path)


More information about the Gcc-cvs mailing list