Commit 78668d5a authored by Bastien Montagne's avatar Bastien Montagne
Browse files

Advanced bug logger: add branch's name to commits range.

Useful, since after RC1 we need to only consider bugs backported to current release branch.
parent f8ce17e8
......@@ -179,3 +179,31 @@ class GitCommitIter:
else:
raise StopIteration
class GitRepo:
__slots__ = (
"_path",
"_git_dir",
)
def __init__(self, path):
self._path = path
self._git_dir = os.path.join(path, ".git")
@property
def branch(self):
cmd = (
"git",
"--git-dir",
self._git_dir,
"rev-parse",
"--abbrev-ref",
"HEAD",
)
# print(" ".join(cmd))
p = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
)
return p.stdout.read()
......@@ -245,9 +245,14 @@ def print_categories_tree():
print("\t\t[%d] %s" % (j, sub_cat))
def release_log_init(path, blender_rev, start_sha1, end_sha1):
def release_log_init(path, source_dir, blender_rev, start_sha1, end_sha1):
from git_log import GitRepo
if os.path.exists(path):
release_log = {}
branch = GitRepo(source_dir).branch.decode().strip()
sub_cats_to_main_cats = {s_cat: m_cat[0] for m_cat in BUGFIX_CATEGORIES for s_cat in m_cat[1]}
main_cats = {m_cat[0] for m_cat in BUGFIX_CATEGORIES}
with open(path, 'r') as f:
......@@ -272,7 +277,8 @@ def release_log_init(path, blender_rev, start_sha1, end_sha1):
header.append(hl)
release_log["__HEADER__"] = "%s\nChanges from revision {{GitCommit|%s}} to {{GitCommit|%s}}, " \
"inclusive.\n\n" % ("\n".join(header), start_sha1[:10], end_sha1[:10])
"inclusive (''%s'' branch).\n\n" \
"" % ("\n".join(header), start_sha1[:10], end_sha1[:10], branch)
count = release_log["__COUNT__"] = [0, 0]
continue
......@@ -452,9 +458,8 @@ def main():
if args.accept_releaselog:
blender_rev = args.blender_rev or "<UNKNOWN>"
commits = tuple(GitCommitIter(args.source_dir, args.range_sha1))
release_log = release_log_init(ACCEPT_RELEASELOG_FILE, blender_rev,
release_log = release_log_init(ACCEPT_RELEASELOG_FILE, args.source_dir, blender_rev,
commits[-1].sha1.decode(), commits[0].sha1.decode())
#~ return
commits = [c for c in commits if match(c)]
else:
commits = [c for c in GitCommitIter(args.source_dir, args.range_sha1) if match(c)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment