aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-06-18 14:14:24 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:13:59 -0300
commit0b1c8201a275484f625eaaa9cb666c28af1e5874 (patch)
treea65cc864bd34534a846f3532137ccbe67f773256
parentb2386ff01b09c5223a2e9e506513bcf90714aebf (diff)
downloadgcc-0b1c8201a275484f625eaaa9cb666c28af1e5874.zip
gcc-0b1c8201a275484f625eaaa9cb666c28af1e5874.tar.gz
gcc-0b1c8201a275484f625eaaa9cb666c28af1e5874.tar.bz2
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.
-rwxr-xr-xcontrib/gcc-changelog/git_update_version.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index 733a1a0..7077880 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)