gcc-changelog: respect branch in git_update_version.py.

Message ID 1bbb36e1-343e-7a21-d4f8-21bdaaeb4ad5@suse.cz
State New
Headers show
Series
  • gcc-changelog: respect branch in git_update_version.py.
Related show

Commit Message

Martin Liška May 12, 2021, 8:38 a.m.
Hi.

The patch fixes Dially bump strict.
Pushed to master.

Martin

contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Simplify needle lookup.
	* gcc-changelog/git_update_version.py: Pass ref_name to
	parse_git_revisions.
---
  contrib/gcc-changelog/git_commit.py         | 2 +-
  contrib/gcc-changelog/git_update_version.py | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.31.1

Patch

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index c70279e2504..8f9b266fde9 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -394,7 +394,7 @@  class GitCommit:
          self.changelog_locations = list(default_changelog_locations)
          if ref_name:
              version = sys.maxsize
-            if ref_name.startswith('refs/heads/releases/gcc-'):
+            if 'releases/gcc-' in ref_name:
                  version = int(ref_name.split('-')[-1])
              if version >= 12:
                  # HSA and BRIG were removed in GCC 12
diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py
index 9bc41bb4cc1..0a21a748e72 100755
--- a/contrib/gcc-changelog/git_update_version.py
+++ b/contrib/gcc-changelog/git_update_version.py
@@ -78,7 +78,7 @@  repo = Repo(args.git_path)
  origin = repo.remotes['origin']
  
  
-def update_current_branch():
+def update_current_branch(ref_name):
      commit = repo.head.commit
      commit_count = 1
      while commit:
@@ -101,7 +101,7 @@  def update_current_branch():
          if len(head.parents) == 2:
              head = head.parents[1]
          commits = parse_git_revisions(args.git_path, '%s..%s'
-                                      % (commit.hexsha, head.hexsha))
+                                      % (commit.hexsha, head.hexsha), ref_name)
          commits = [c for c in commits if c.info.hexsha not in IGNORED_COMMITS]
          for git_commit in reversed(commits):
              prepend_to_changelog_files(repo, args.git_path, git_commit,
@@ -145,6 +145,6 @@  else:
              branch.checkout()
              origin.pull(rebase=True)
              print('branch pulled and checked out')
-            update_current_branch()
+            update_current_branch(name)
              assert not repo.index.diff(None)
              print('branch is done\n', flush=True)