Skip to content
Browse files
Replace with, works with change…
  • Loading branch information
djc committed Jul 31, 2013
1 parent 7285231 commit 8b986880ef7813ea67a93abe02d73b5d86289265
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 114 deletions.
@@ -0,0 +1,94 @@
#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# This script is for use by committers.
# It should be used in accordance with the project release procedure.
# cf.

from docutils import core
import sys, os, tempfile

EMAIL_TPL = 'discuss_release.txt'

def red(s):
return '\033[1;31m%s\033[0m' % s

def get_section(doc_path, version):

version_info = version.split('.')
if version_info[2] == '0':
branch = '.'.join(version_info[:2]) + '.x Branch'
start = lambda x: x.startswith(branch)
end = lambda x: x.rstrip().endswith('.x Branch')
start = lambda x: x.startswith('Version ' + version)
end = lambda x: x.startswith('Version ')

state, lines = 0, []
with open(doc_path) as f:
for ln in f:
#print state, ln, start(ln), end(ln)
if state == 0 and start(ln):
state = 1
elif state == 1 and end(ln):
if state:

if version_info[2] == '0':
return ''.join(lines[7:]).rstrip()
return ''.join(lines[3:]).rstrip()

def main(cache, branch, version):

dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(dir, EMAIL_TPL)) as f:
tpl =

print red('Parsing documentation')
changelog_fn = os.path.join(cache, 'branch', branch, 'changelog.rst')
changelog = get_section(changelog_fn, version)

tpl = tpl.replace('%VERSION%', version)
tpl = tpl.replace('%CHANGELOG%', changelog)
print 'Email text:'
print tpl
print 'Send the email to:'

if __name__ == '__main__':

if len(sys.argv) < 2:
print 'Usage: <cache-dir> <branch> <version>'

if not os.path.isdir(sys.argv[1]):
print 'error: no cache directory'

cache = sys.argv[1]
if len(sys.argv) < 3:
print 'error: no branch'

branch = sys.argv[2]
if len(sys.argv) < 4:
print 'error: no version'

version = sys.argv[3]
main(cache, branch, version)

This file was deleted.

@@ -9,14 +9,10 @@ I would like to propose that we release Apache CouchDB %VERSION%.

The project aims to produce time-based releases. If your favourite feature is not ready for this version, it can be included in the next version. However, if you know of anything that should block the release, please speak up now.

The %VERSION% NEWS entry as it stands:
The %VERSION% changelog as it stands:


The %VERSION% CHANGES entry as it stands:


Are these accurate? Please double check any work you may have done and make sure that the corresponding NEWS and CHANGES entries are up-to-date.
Are these accurate? Please double check any work you may have done and make sure that the corresponding changelog entries are up-to-date.


0 comments on commit 8b98688

Please sign in to comment.