提交 b164b86e 编写于 作者: E Eric Seidel

Teach roll_versions.py how to update CHANGELOG.md files.

This is feature creep.  But it was simple and fun. :p

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175393002.
上级 583b126b
......@@ -3,7 +3,7 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.domokit.sky.demo" android:versionCode="9" android:versionName="0.0.9">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.domokit.sky.demo" android:versionCode="10" android:versionName="0.0.10">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
......
## 0.0.10
- 23 changes: https://github.com/domokit/mojo/compare/1b7bcee...be9dad7
## 0.0.8
- Fix 2 crashes in SkyDemo.apk, updated widgets. 0.0.7 was skipped.
......
......@@ -6,4 +6,4 @@ dependencies:
description: Dart files to support executing inside Sky.
homepage: https://github.com/domokit/mojo/tree/master/sky
name: sky
version: 0.0.9
version: 0.0.10
......@@ -3,9 +3,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import yaml
import xml.etree.ElementTree as ET
PUBSPECS = [
'sky/sdk/pubspec.yaml',
'mojo/public/dart/pubspec.yaml',
......@@ -38,6 +41,15 @@ def sort_dict(unsorted):
return sorted_dict
def count_commits(start, end):
return subprocess.check_output([
'git', 'rev-list', '%s...%s' % (start, end)]).count('\n')
def last_commit_to(file_path):
return subprocess.check_output(['git', 'log', '-1', '--format=%h', file_path]).strip()
def update_pubspec(pubspec):
# TODO(eseidel): This does not prserve any manual sort-order of the yaml.
with open(pubspec, 'r') as stream:
......@@ -48,6 +60,20 @@ def update_pubspec(pubspec):
with open(pubspec, 'w') as stream:
yaml.dump(spec, stream=stream, default_flow_style=False)
return spec['version']
def update_changelog(changelog, pubspec, version):
old = last_commit_to(pubspec)
new = last_commit_to('.')
url = "https://github.com/domokit/mojo/compare/%s...%s" % (old, new)
count = count_commits(old, new)
message = """## %s
- %s changes: %s
""" % (version, count, url)
prepend_to_file(message, changelog)
def prepend_to_file(to_prepend, filepath):
......@@ -77,9 +103,13 @@ def update_manifest(manifest):
def main():
# Should chdir to the root directory.
print 'Pub packages:'
for pubspec in PUBSPECS:
update_pubspec(pubspec)
new_version = update_pubspec(pubspec)
changelog = os.path.join(os.path.dirname(pubspec), 'CHANGELOG.md')
update_changelog(changelog, pubspec, new_version)
# TODO(eseidel): Without this ET uses 'ns0' for 'android' which is wrong.
ET.register_namespace('android', 'http://schemas.android.com/apk/res/android')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册