public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Giuliano Belinassi <giulianob@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/autopar_devel] gcc-changelog: support merge commits in git_update_version
Date: Sat, 22 Aug 2020 22:49:44 +0000 (GMT)	[thread overview]
Message-ID: <20200822224944.4B6C13861838@sourceware.org> (raw)

https://gcc.gnu.org/g:0b1c8201a275484f625eaaa9cb666c28af1e5874

commit 0b1c8201a275484f625eaaa9cb666c28af1e5874
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Jun 18 14:14:24 2020 +0200

    gcc-changelog: support merge commits in git_update_version
    
    contrib/ChangeLog:
    
            * gcc-changelog/git_update_version.py: Support merge commits
            and walk only on the branch that is being merged and generate
            missing ChangeLog entries.

Diff:
---
 contrib/gcc-changelog/git_update_version.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index 733a1a0f14a..7077880cf80 100755
--- a/contrib/gcc-changelog/git_update_version.py
+++ b/contrib/gcc-changelog/git_update_version.py
@@ -81,15 +81,23 @@ def update_current_branch():
         if (commit.author.email == 'gccadmin@gcc.gnu.org'
                 and commit.message.strip() == 'Daily bump.'):
             break
-        commit = commit.parents[0]
+        # We support merge commits but only with 2 parensts
+        assert len(commit.parents) <= 2
+        commit = commit.parents[-1]
         commit_count += 1
 
     print('%d revisions since last Daily bump' % commit_count)
     datestamp_path = os.path.join(args.git_path, 'gcc/DATESTAMP')
     if (read_timestamp(datestamp_path) != current_timestamp
             or args.dry_mode or args.current):
-        commits = parse_git_revisions(args.git_path, '%s..HEAD'
-                                      % commit.hexsha)
+        head = repo.head.commit
+        # if HEAD is a merge commit, start with second parent
+        # (branched that is being merged into the current one)
+        assert len(head.parents) <= 2
+        if len(head.parents) == 2:
+            head = head.parents[1]
+        commits = parse_git_revisions(args.git_path, '%s..%s'
+                                      % (commit.hexsha, head.hexsha))
         for git_commit in reversed(commits):
             prepend_to_changelog_files(repo, args.git_path, git_commit,
                                        not args.dry_mode)


                 reply	other threads:[~2020-08-22 22:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200822224944.4B6C13861838@sourceware.org \
    --to=giulianob@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).