Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions dev-support/git-jira-release-audit/git_jira_release_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,21 @@ def flush_commits(self):
"""Commit any pending changes to the database."""
self.conn.commit()

def apply_git_tag(self, branch, git_sha, git_tag):
def apply_git_tag(self, branch, git_tag, git_shas):
"""Annotate a commit in the commits database as being a part of the specified release.

Args:
branch (str): The name of the git branch from which the commit originates.
git_sha (str): The commit's SHA.
git_tag (str): The first release tag following the commit.
git_shas: The commits' SHAs.
"""
self.conn.execute("UPDATE git_commits SET git_tag = ? WHERE branch = ? AND git_sha = ?",
(git_tag, branch, git_sha))
self.conn.execute(
(
f"UPDATE git_commits SET git_tag = ?"
f" WHERE branch = ?"
f" AND git_sha in ({','.join('?' for _ in git_shas)})"
),
[git_tag, branch] + git_shas)

def apply_fix_version(self, jira_id, fix_version):
"""Annotate a Jira issue in the jira database as being part of the specified release
Expand Down Expand Up @@ -327,12 +332,7 @@ def _extract_release_tag(self, commit):
return None

def _set_release_tag(self, branch, tag, shas):
cnt = 0
for sha in shas:
self._db.apply_git_tag(branch, sha, tag)
cnt += 1
if cnt % 50 == 0:
self._db.flush_commits()
self._db.apply_git_tag(branch, tag, shas)
self._db.flush_commits()

def _resolve_ambiguity(self, commit):
Expand Down