Merge "diff_branches: add RST support"

This commit is contained in:
Jenkins 2015-11-13 12:53:56 +00:00 committed by Gerrit Code Review
commit cc6f9331d7
2 changed files with 66 additions and 5 deletions

View File

@ -215,8 +215,9 @@ def get_env(project, new_branch, old_list, new_list):
for name in sorted(new_opts, _cmpopts):
opt = new_list[name][1]
name = format_option_name(name)
cells = ("%(name)s = %(default)s" % {'name': name,
'default': opt['default']},
cells = (("%(name)s = %(default)s" %
{'name': name,
'default': opt['default']}).strip(),
"(%(type)s) %(help)s" % {'type': opt['type'],
'help': opt['help']})
env['new_opts'].append(cells)
@ -266,6 +267,13 @@ def main():
required=False,
default='.',
type=str,)
parser.add_argument('-f', '--format',
dest='format',
help='Output format (docbook or rst).',
required=False,
default='rst',
type=str,
choices=('docbook', 'rst'),)
parser.add_argument('-n', '--no-venv-update',
dest='novenvupdate',
help='Don\'t update the virtual envs.',
@ -288,9 +296,10 @@ def main():
release = args.new_branch.replace('stable/', '')
env = get_env(project, release, old_list, new_list)
filename = ("%(project)s-conf-changes.xml" %
{'project': project, 'release': release})
tmpl_file = 'templates/changes.docbook.j2'
ext = 'rst' if args.format == 'rst' else 'xml'
filename = ("%(project)s-conf-changes.%(ext)s" %
{'project': project, 'ext': ext})
tmpl_file = 'templates/changes.%s.j2' % args.format
if not os.path.exists(args.target):
os.makedirs(args.target)
dest = os.path.join(args.target, filename)

View File

@ -0,0 +1,52 @@
New, updated, and deprecated options in {{ release }} for {{ codename }}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{{ '~' * release|length }}~~~~~{{ '~' * codename|length }}
..
Warning: Do not edit this file. It is automatically generated and your
changes will be overwritten. The tool to do so lives in the
openstack-doc-tools repository.
{% if new_opts %}
.. list-table:: New options
:header-rows: 1
:class: config-ref-table
* - Option = default value
- (Type) Help string
{% for cells in new_opts %}
* - ``{{ cells[0] }}``
- ``{{ cells[1] }}``
{% endfor %}
{% endif %}
{% if new_defaults %}
.. list-table:: New default values
:header-rows: 1
:class: config-ref-table
* - Option
- Previous default value
- New default value
{% for cells in new_defaults %}
* - ``{{ cells[0] }}``
- ``{{ cells[1] }}``
- ``{{ cells[2]|default(' ', true) }}``
{% endfor %}
{% endif %}
{% if deprecated_opts %}
.. list-table:: Deprecated options
:header-rows: 1
:class: config-ref-table
* - Deprecated option
- New Option
{% for cells in new_opts %}
* - ``{{ cells[0] }}``
- ``{{ cells[1] }}``
{% endfor %}
{% endif %}
{% if not new_opts and not new_defaults and not deprecated_opts %}
There are no new, updated, and deprecated options in {{ release }} for {{ codename }}.
{% endif %}