Skip to content

Commit eaf5540

Browse files
authored
Adjusted releasenotes script to new issue style (defold#4751)
* Adjusted releasenotes script to new issue style Updated links from Jira to GitHub * Update releasenotes_git.py
1 parent 5da3a52 commit eaf5540

File tree

1 file changed

+74
-55
lines changed

1 file changed

+74
-55
lines changed

scripts/releasenotes_git.py

Lines changed: 74 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,25 @@
22

33
import os, sys, subprocess, re
44

5-
ISSUE_PATTERN='^([a-fA-F0-9]+)\s(DEF-\d+|DEFEDIT-\d+|)(.*)'
5+
BETA_INTRO = """# Defold %s BETA
6+
The latest beta is now released, and we invite those interested in beta testing the new features in the editor and engine to join now.
7+
The beta period will be 2 weeks and the next planned stable release is two weeks from now.
8+
9+
We hope this new workflow will highlight any issues earlier, and also get valuable feedback from our users. And please comment if you come up with ideas on improving on this new workflow.
10+
11+
Please report any engine issues in this thread or in [editor2-issues](https://github.com/defold/editor2-issues/issues) using Help -> Report Issue
12+
13+
Thx for helping out!
14+
15+
## Disclaimer
16+
This is a BETA release, and it might have issues that could potentially be disruptive for you and your teams workflow. Use with caution. Use of source control for your projects is strongly recommended.
17+
18+
## Access to the beta
19+
Download the editor or bob.jar from http://d.defold.com/beta/
20+
21+
Set your build server to https://build-stage.defold.com
22+
23+
"""
624

725
def run(cmd):
826
p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
@@ -24,73 +42,74 @@ def get_version():
2442
return (sha1, "%s.%s.%d" % (tokens[0], tokens[1], minor))
2543
return (sha1, "<unknown>")
2644

27-
def get_each_change(line):
28-
m = re.search(ISSUE_PATTERN, line)
29-
if not m:
30-
print line
31-
return
32-
sha1 = m.group(1)
33-
issue = m.group(2)
34-
desc = m.group(3)
35-
36-
print sha1, issue
37-
38-
out = run("git log %s -1" % sha1)
39-
print out
40-
41-
def get_each_link(line):
42-
m = re.search(ISSUE_PATTERN, line)
43-
if not m:
44-
return
45-
issue = m.group(2)
46-
desc = m.group(3)
4745

48-
print " * [`%s`](https://jira.int.midasplayer.com/browse/%s) - **Fixed**: %s" % (issue, issue, desc)
49-
50-
51-
def get_all_changes(version):
52-
out = run("git log %s..HEAD --oneline" % version)
46+
def git_log(sha1):
47+
return run("git log %s -1" % sha1)
48+
49+
50+
def get_engine_issues(lines):
51+
issues = []
52+
for line in lines:
53+
# 974d82a24 Issue-4684 - Load vulkan functions dynamically on android (#4692)
54+
issue_match = re.search("^([a-fA-F0-9]+) Issue\-#?(\d+):? (.*)", line)
55+
if issue_match:
56+
sha1 = issue_match.group(1)
57+
issue = issue_match.group(2)
58+
desc = issue_match.group(3)
59+
# get rid of PR number at the end of the commit
60+
m = re.search("^(.*) \(\#\d+\)$", desc)
61+
if m:
62+
desc = m.group(1)
63+
issues.append("[`Issue-%s`](https://github.com/defold/issues/%s) - **Fixed**: %s" % (issue, issue, desc))
64+
print(git_log(sha1))
65+
continue
66+
67+
# bca92cc0f Check that there's a world before creating a collision object (#4747)
68+
pull_match = re.search("([a-fA-F0-9]+) (.*) \(\#(\d+)\)$", line)
69+
if pull_match:
70+
sha1 = pull_match.group(1)
71+
desc = pull_match.group(2)
72+
pr = pull_match.group(3)
73+
issues.append("[`PR #%s`](https://github.com/defold/pull/%s) - **Fixed**: %s" % (pr, pr, desc))
74+
print(git_log(sha1))
75+
return issues
76+
77+
def get_editor_issues(lines):
78+
issues = []
79+
for line in lines:
80+
# bca92cc0f Foobar (DEFEDIT-4747)
81+
m = re.search("^([a-fA-F0-9]+) (.*) \(DEFEDIT-(\d+)\)", line)
82+
if m:
83+
sha1 = m.group(1)
84+
desc = m.group(2)
85+
issue = m.group(3)
86+
issues.append("[`DEFEDIT-%s`](https://github.com/defold/defold/search?q=hash%%3A%s&type=Commits) - **Fixed**: %s" % (issue, sha1, desc))
87+
print(git_log(sha1))
88+
return issues
89+
90+
def get_all_changes(version, sha1):
91+
out = run("git log %s..HEAD --oneline" % sha1)
5392
lines = out.split('\n')
5493

5594
print out
5695
print "#" + "*" * 64
5796

58-
# Note: currently doesn't catch merges of the form:
59-
# "xxxxxxxxx Merge pull request #XXXX from defold/DEF-NUMBERsomething"
60-
def keep(s):
61-
if not s:
62-
return False
63-
if 'Merge pull request' in s:
64-
return False
65-
if 'Merge branch' in s:
66-
return False
67-
m = re.search(ISSUE_PATTERN, s)
68-
if m:
69-
return True
70-
return False
71-
72-
lines = [l for l in lines if keep(l)]
73-
lines = sorted(lines)
74-
75-
print ""
76-
print ""
77-
78-
for l in lines:
79-
get_each_change(l)
97+
engine_issues = get_engine_issues(lines)
98+
editor_issues = get_editor_issues(lines)
8099

81100
print ""
101+
print "#" + "*" * 64
82102
print ""
103+
print BETA_INTRO % version
83104
print "# Engine"
84105

85-
for l in lines:
86-
if 'DEF-' in l:
87-
get_each_link(l)
106+
for issue in engine_issues:
107+
print(" * " + issue)
88108

89109
print "# Editor"
90110

91-
for l in lines:
92-
if 'DEFEDIT-' in l:
93-
get_each_link(l)
111+
for issue in editor_issues:
112+
print(" * " + issue)
94113

95114

96115

@@ -101,4 +120,4 @@ def keep(s):
101120
sys.exit(1)
102121

103122
print "Found version", version, sha1
104-
get_all_changes(sha1)
123+
get_all_changes(version, sha1)

0 commit comments

Comments
 (0)