diff --git a/changelog.py b/changelog.py index 758c857fe..d4f063f16 100644 --- a/changelog.py +++ b/changelog.py @@ -44,40 +44,10 @@ def getBuildInfo(url): item['author'] = item['author']['fullName'] build.pop('changeSet') build.pop('actions') - #pprint(data) return data - -def main(): - target_build = 0 - job_path = None - change_file = None - if len(sys.argv) > 3: - try: - target_build = int(sys.argv[1]) - job_path = sys.argv[2] - change_file = sys.argv[3] - except: - pass - else: - target_build = 10000 - job_path = "http://jenkins.minecraftforge.net/job/forge/" - change_file = "changes.txt" - p = re.compile('\w+-(?P\w+)-(?P[\d]+.[\d]+.[\d]+.(?P[\d]+)).zip') - builds = {} - for filename in os.listdir('D:\\tmp'): - m = p.search(filename) - if not m is None: - builds[m.group('build')] = m.group('version') - #pprint(builds) - - for key in sorted(builds.iterkeys(), key=lambda key: int(key)): - print '%s %s' % (key, builds[key]) - make_changelog(job_path, int(key), 'd:\\tmp\minecraftforge-changelog-%s.txt' % builds[key]) - -def make_changelog(job_path, target_build, change_file): +def make_changelog(job_path, target_build, change_file, current_version=None): builds = getBuildInfo('%s/api/python?tree=builds[number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path) - #pprint(builds) log = [ "Changelog:" ] @@ -86,7 +56,10 @@ def make_changelog(job_path, target_build, change_file): if len(build['items']) == 0: continue log.append('') if build['version'] is None: - log.append('Build %s' % build['number']) + if current_version is None: + log.append('Build %s' % build['number']) + else: + log.append('Build %s' % current_version) else: log.append('Build %s' % build['version']) for change in build['items']: @@ -98,11 +71,7 @@ def make_changelog(job_path, target_build, change_file): elif len(comments) == 1: log.append('\t%s: %s' % (change['author'], comments[0])) - #print '\n'.join(log) file = open(change_file, 'wb') for line in log: file.write('%s\n' % line) - file.close() - -if __name__ == '__main__': - main() \ No newline at end of file + file.close() \ No newline at end of file diff --git a/release.py b/release.py index 8e5ba6803..eccf17de4 100644 --- a/release.py +++ b/release.py @@ -57,7 +57,7 @@ def main(): os.makedirs(out_folder) changelog_file = 'forge-%s/minecraftforge-changelog-%s.txt' % (version_str, version_str) - make_changelog("http://jenkins.minecraftforge.net/job/forge/", build_num, changelog_file) + make_changelog("http://jenkins.minecraftforge.net/job/forge/", build_num, changelog_file, version_str) version_file = 'forgeversion.properties' if os.path.exists(version_file):