Hello community, here is the log from the commit of package python-reno for openSUSE:Factory checked in at 2018-02-26 23:25:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-reno (Old) and /work/SRC/openSUSE:Factory/.python-reno.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-reno" Mon Feb 26 23:25:51 2018 rev:6 rq:580045 version:2.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-reno/python-reno.changes 2017-12-07 13:54:04.024783229 +0100 +++ /work/SRC/openSUSE:Factory/.python-reno.new/python-reno.changes 2018-02-26 23:25:53.084752872 +0100 @@ -1,0 +2,9 @@ +Mon Feb 26 07:04:59 UTC 2018 - cloud-de...@suse.de + +- update to version 2.7.0 + - improve output messages + - add an internal sphinx extension to show the configuration defaults + - support scanning closed stable branches + - define options with help text + +------------------------------------------------------------------- Old: ---- reno-2.6.0.tar.gz New: ---- reno-2.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-reno.spec ++++++ --- /var/tmp/diff_new_pack.HmIbzW/_old 2018-02-26 23:25:53.956721513 +0100 +++ /var/tmp/diff_new_pack.HmIbzW/_new 2018-02-26 23:25:53.956721513 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-reno # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,36 +17,39 @@ Name: python-reno -Version: 2.6.0 +Version: 2.7.0 Release: 0 Summary: RElease NOtes manager License: Apache-2.0 Group: Development/Languages/Python Url: http://www.openstack.org/ -Source0: https://files.pythonhosted.org/packages/source/r/reno/reno-2.6.0.tar.gz +Source0: https://files.pythonhosted.org/packages/source/r/reno/reno-2.7.0.tar.gz BuildRequires: openstack-macros BuildRequires: python-devel -BuildRequires: python2-Babel >= 2.3.4 BuildRequires: python2-PyYAML >= 3.10 +BuildRequires: python2-Sphinx +BuildRequires: python2-docutils >= 0.11 BuildRequires: python2-dulwich >= 0.15.0 -BuildRequires: python2-oslotest >= 1.10.0 +BuildRequires: python2-oslotest >= 3.2.0 BuildRequires: python2-pbr >= 2.0.0 BuildRequires: python2-setuptools >= 16.0 BuildRequires: python2-testrepository >= 0.0.18 BuildRequires: python2-testscenarios >= 0.4 BuildRequires: python2-testtools >= 2.2.0 -BuildRequires: python3-Babel >= 2.3.4 BuildRequires: python3-PyYAML >= 3.10 +BuildRequires: python3-Sphinx BuildRequires: python3-devel +BuildRequires: python3-docutils >= 0.11 BuildRequires: python3-dulwich >= 0.15.0 -BuildRequires: python3-oslotest >= 1.10.0 +BuildRequires: python3-oslotest >= 3.2.0 BuildRequires: python3-pbr >= 2.0.0 BuildRequires: python3-setuptools >= 16.0 BuildRequires: python3-testrepository >= 0.0.18 BuildRequires: python3-testscenarios >= 0.4 BuildRequires: python3-testtools >= 2.2.0 -Requires: python-Babel >= 2.3.4 Requires: python-PyYAML >= 3.10 +Requires: python-Sphinx +Requires: python-docutils >= 0.11 Requires: python-dulwich >= 0.15.0 BuildArch: noarch %if 0%{?suse_version} @@ -68,7 +71,7 @@ repository and then building documentation from them. %prep -%autosetup -p1 -n reno-2.6.0 +%autosetup -p1 -n reno-2.7.0 %py_req_cleanup %build ++++++ reno-2.6.0.tar.gz -> reno-2.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/ChangeLog new/reno-2.7.0/ChangeLog --- old/reno-2.6.0/ChangeLog 2017-11-16 10:33:40.000000000 +0100 +++ new/reno-2.7.0/ChangeLog 2018-02-01 02:14:43.000000000 +0100 @@ -1,6 +1,14 @@ CHANGES ======= +2.7.0 +----- + +* support scanning closed stable branches +* improve output messages +* add an internal sphinx extension to show the configuration defaults +* define options with help text + 2.6.0 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/PKG-INFO new/reno-2.7.0/PKG-INFO --- old/reno-2.6.0/PKG-INFO 2017-11-16 10:33:40.000000000 +0100 +++ new/reno-2.7.0/PKG-INFO 2018-02-01 02:14:43.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: reno -Version: 2.6.0 +Version: 2.7.0 Summary: RElease NOtes manager Home-page: https://docs.openstack.org/reno/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/doc/source/conf.py new/reno-2.7.0/doc/source/conf.py --- old/reno-2.6.0/doc/source/conf.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/doc/source/conf.py 2018-02-01 02:12:11.000000000 +0100 @@ -25,7 +25,6 @@ has_theme = True -sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be @@ -34,6 +33,7 @@ 'sphinx.ext.autodoc', # 'sphinx.ext.intersphinx', 'reno.sphinxext', + 'reno._exts.show_reno_config', ] if has_theme: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/doc/source/user/usage.rst new/reno-2.7.0/doc/source/user/usage.rst --- old/reno-2.6.0/doc/source/user/usage.rst 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/doc/source/user/usage.rst 2018-02-01 02:12:11.000000000 +0100 @@ -220,102 +220,7 @@ The following options are configurable: -`notesdir` - The notes subdirectory within the `relnotesdir` where the notes live. - - Defaults to ``notes``. - -`collapse_pre_releases` - Should pre-release versions be merged into the final release of the same - number (`1.0.0.0a1` notes appear under `1.0.0`). - - Defaults to ``True``. - -`stop_at_branch_base` - Should the scanner stop at the base of a branch (True) or go ahead and scan - the entire history (False)? - - Defaults to ``True``. - -`branch` - The git branch to scan. If a stable branch is specified but does not exist, - reno attempts to automatically convert that to an "end-of-life" tag. For - example, ``origin/stable/liberty`` would be converted to ``liberty-eol``. - - Defaults to the "current" branch checked out. - -`earliest_version` - The earliest version to be included. This is usually the lowest version - number, and is meant to be the oldest version. If unset, all versions will be - scanned. - - Defaults to ``None``. - -`template` - The template used by reno new to create a note. - -`release_tag_re` - The regex pattern used to match the repo tags representing a valid release - version. The pattern is compiled with the verbose and unicode flags enabled. - - Defaults to ``((?:[\d.ab]|rc)+)``. - -`pre_release_tag_re` - The regex pattern used to check if a valid release version tag is also a - valid pre-release version. The pattern is compiled with the verbose and - unicode flags enabled. The pattern must define a group called `pre_release` - that matches the pre-release part of the tag and any separator, e.g for - pre-release version `12.0.0.0rc1` the default RE pattern will identify - `.0rc1` as the value of the group 'pre_release'. - - Defaults to ``(?P<pre_release>\.\d+(?:[ab]|rc)+\d*)$``. - -`branch_name_re` - The pattern for names for branches that are relevant when scanning history to - determine where to stop, to find the "base" of a branch. Other branches are - ignored. - - Defaults to ``stable/.+``. - -`sections` - The identifiers and names of permitted sections in the release notes, in the - order in which the final report will be generated. A prelude section will - always be automatically inserted before the first element of this list. - -`prelude_section_name` - The name of the prelude section in the note template. Note that the - value for this must be a single word, but can have underscores. The - value is displayed in titlecase in the report after replacing - underscores with spaces. - - Defaults to ``prelude`` - -`ignore_null_merges` - OpenStack used to use null-merges to bring final release tags from - stable branches back into the master branch. This confuses the - regular traversal because it makes that stable branch appear to be - part of master and/or the later stable branch. This option allows us - to ignore those. - - When this option is set to True, any merge commits with no changes - and in which the second or later parent is tagged are considered - "null-merges" that bring the tag information into the current branch - but nothing else. - - Defaults to ``True``. - -`ignore_notes` - A list of filenames or UIDs for notes that should be ignored by the - reno scanner. It is most useful to set this when a note is edited on - the wrong branch, making it appear to be part of a release that it - is not. - - .. warning:: - - Setting the option in the main configuration file makes it apply - to all branches. To ignore a note in the HTML build, use the - ``ignore-notes`` parameter to the ``release-notes`` sphinx - directive. +.. show-reno-config:: Debugging ========= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/releasenotes/notes/add-closed-branch-config-options-8773caf240e4653f.yaml new/reno-2.7.0/releasenotes/notes/add-closed-branch-config-options-8773caf240e4653f.yaml --- old/reno-2.6.0/releasenotes/notes/add-closed-branch-config-options-8773caf240e4653f.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/reno-2.7.0/releasenotes/notes/add-closed-branch-config-options-8773caf240e4653f.yaml 2018-02-01 02:12:11.000000000 +0100 @@ -0,0 +1,19 @@ +--- +features: + - | + Adds new configuration options ``closed_branch_tag_re`` (to + identify tags that replace branches that have been closed) and + ``branch_name_prefix`` (a value to be added back to the closed + branch tag to turn it into the original branch name. + + These options are used in OpenStack to support scanning the + history of a branch based on the previous series branch, even + after that previous series is closed by setting + ``closed_branch_tag_re`` to ``(.+)-eol`` so that the series name + in a value like ``"mitaka-eol"`` is extracted using the + group. With ``branch_name_prefix`` set to ``"stable/"`` the tag + ``mitaka-eol`` becomes the branch name ``stable/mitaka``. +fixes: + - | + Fixes bug 1746076 so that scanning stable branches correctly + includes the history of earlier closed stable branches. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/_exts/show_reno_config.py new/reno-2.7.0/reno/_exts/show_reno_config.py --- old/reno-2.6.0/reno/_exts/show_reno_config.py 1970-01-01 01:00:00.000000000 +0100 +++ new/reno-2.7.0/reno/_exts/show_reno_config.py 2018-02-01 02:12:11.000000000 +0100 @@ -0,0 +1,75 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +from docutils import nodes +from docutils.parsers import rst +from docutils.statemachine import ViewList + +from sphinx.util.nodes import nested_parse_with_titles + +from reno import config +import six + + +def _multi_line_string(s, indent=''): + output_lines = s.splitlines() + if not output_lines[0].strip(): + output_lines = output_lines[1:] + for l in output_lines: + yield indent + l + + +def _format_option_help(options): + "Produce RST lines for the configuration options." + for opt in options: + yield '``{}``'.format(opt.name) + for l in _multi_line_string(opt.help, ' '): + yield l + yield '' + if isinstance(opt.default, six.string_types) and '\n' in opt.default: + # Multi-line string + yield ' Defaults to' + yield '' + yield ' ::' + yield '' + for l in _multi_line_string(opt.default, ' '): + yield l + else: + yield ' Defaults to ``{!r}``'.format(opt.default) + yield '' + + +class ShowConfigDirective(rst.Directive): + + option_spec = {} + + has_content = True + + def run(self): + env = self.state.document.settings.env + app = env.app + + result = ViewList() + source_name = '<' + __name__ + '>' + for line in _format_option_help(config._OPTIONS): + app.info(line) + result.append(line, source_name) + + node = nodes.section() + node.document = self.state.document + nested_parse_with_titles(self.state, result, node) + + return node.children + + +def setup(app): + app.add_directive('show-reno-config', ShowConfigDirective) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/config.py new/reno-2.7.0/reno/config.py --- old/reno-2.6.0/reno/config.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/reno/config.py 2018-02-01 02:12:11.000000000 +0100 @@ -10,8 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +import collections import logging import os.path +import textwrap import yaml @@ -20,62 +22,101 @@ LOG = logging.getLogger(__name__) -class Config(object): +Opt = collections.namedtuple('Opt', 'name default help') + +_OPTIONS = [ + Opt('notesdir', defaults.NOTES_SUBDIR, + textwrap.dedent("""\ + The notes subdirectory within the relnotesdir where the + notes live. + """)), + + Opt('collapse_pre_releases', True, + textwrap.dedent("""\ + Should pre-release versions be merged into the final release + of the same number (1.0.0.0a1 notes appear under 1.0.0). + """)), + + Opt('stop_at_branch_base', True, + textwrap.dedent("""\ + Should the scanner stop at the base of a branch (True) or go + ahead and scan the entire history (False)? + """)), + + Opt('branch', None, + textwrap.dedent("""\ + The git branch to scan. Defaults to the "current" branch + checked out. If a stable branch is specified but does not + exist, reno attempts to automatically convert that to an + "end-of-life" tag. For example, ``origin/stable/liberty`` + would be converted to ``liberty-eol``. + """)), + + Opt('earliest_version', None, + textwrap.dedent("""\ + The earliest version to be included. This is usually the + lowest version number, and is meant to be the oldest + version. If unset, all versions will be scanned. + """)), + + Opt('template', defaults.TEMPLATE.format(defaults.PRELUDE_SECTION_NAME), + textwrap.dedent("""\ + The template used by reno new to create a note. + """)), + + Opt('release_tag_re', + textwrap.dedent('''\ + ((?:[\d.ab]|rc)+) # digits, a, b, and rc cover regular and + # pre-releases + '''), + textwrap.dedent("""\ + The regex pattern used to match the repo tags representing a + valid release version. The pattern is compiled with the + verbose and unicode flags enabled. + """)), + + Opt('pre_release_tag_re', + textwrap.dedent('''\ + (?P<pre_release>\.\d+(?:[ab]|rc)+\d*)$ + '''), + textwrap.dedent("""\ + The regex pattern used to check if a valid release version tag + is also a valid pre-release version. The pattern is compiled + with the verbose and unicode flags enabled. The pattern must + define a group called 'pre_release' that matches the + pre-release part of the tag and any separator, e.g for + pre-release version '12.0.0.0rc1' the default pattern will + identify '.0rc1' as the value of the group 'pre_release'. + """)), + + Opt('branch_name_re', 'stable/.+', + textwrap.dedent("""\ + The pattern for names for branches that are relevant when + scanning history to determine where to stop, to find the + "base" of a branch. Other branches are ignored. + """)), + + Opt('closed_branch_tag_re', '(.+)-eol', + textwrap.dedent("""\ + The pattern for names for tags that replace closed + branches that are relevant when scanning history to + determine where to stop, to find the "base" of a + branch. Other tags are ignored. + """)), + + Opt('branch_name_prefix', 'stable/', + textwrap.dedent("""\ + The prefix to add to tags for closed branches + to restore the old branch name to allow sorting + to place the tag in the proper place in history. + For example, OpenStack turns "mitaka-eol" into + "stable/mitaka" by removing the "-eol" suffix + via closed_branch_tag_re and setting the prefix + to "stable/". + """)), - _OPTS = { - # The notes subdirectory within the relnotesdir where the - # notes live. - 'notesdir': defaults.NOTES_SUBDIR, - - # Should pre-release versions be merged into the final release - # of the same number (1.0.0.0a1 notes appear under 1.0.0). - 'collapse_pre_releases': True, - - # Should the scanner stop at the base of a branch (True) or go - # ahead and scan the entire history (False)? - 'stop_at_branch_base': True, - - # The git branch to scan. Defaults to the "current" branch - # checked out. - 'branch': None, - - # The earliest version to be included. This is usually the - # lowest version number, and is meant to be the oldest - # version. - 'earliest_version': None, - - # The template used by reno new to create a note. - 'template': defaults.TEMPLATE.format(defaults.PRELUDE_SECTION_NAME), - - # The RE pattern used to match the repo tags representing a valid - # release version. The pattern is compiled with the verbose and unicode - # flags enabled. - 'release_tag_re': ''' - ((?:[\d.ab]|rc)+) # digits, a, b, and rc cover regular and - # pre-releases - ''', - - # The RE pattern used to check if a valid release version tag is also a - # valid pre-release version. The pattern is compiled with the verbose - # and unicode flags enabled. The pattern must define a group called - # 'pre_release' that matches the pre-release part of the tag and any - # separator, e.g for pre-release version '12.0.0.0rc1' the default RE - # pattern will identify '.0rc1' as the value of the group - # 'pre_release'. - 'pre_release_tag_re': ''' - (?P<pre_release>\.\d+(?:[ab]|rc)+\d*)$ - ''', - - # The pattern for names for branches that are relevant when - # scanning history to determine where to stop, to find the - # "base" of a branch. Other branches are ignored. - 'branch_name_re': 'stable/.+', - - # The identifiers and names of permitted sections in the - # release notes, in the order in which the final report will - # be generated. A prelude section will always be automatically - # inserted before the first element of this list. - 'sections': [ + Opt('sections', + [ ['features', 'New Features'], ['issues', 'Known Issues'], ['upgrade', 'Upgrade Notes'], @@ -85,38 +126,59 @@ ['fixes', 'Bug Fixes'], ['other', 'Other Notes'], ], + textwrap.dedent("""\ + The identifiers and names of permitted sections in the + release notes, in the order in which the final report will + be generated. A prelude section will always be automatically + inserted before the first element of this list. + """)), + + Opt('prelude_section_name', defaults.PRELUDE_SECTION_NAME, + textwrap.dedent("""\ + The name of the prelude section in the note template. This + allows users to rename the section to, for example, + 'release_summary' or 'project_wide_general_announcements', + which is displayed in titlecase in the report after + replacing underscores with spaces. + """)), + + Opt('ignore_null_merges', True, + textwrap.dedent("""\ + When this option is set to True, any merge commits with no + changes and in which the second or later parent is tagged + are considered "null-merges" that bring the tag information + into the current branch but nothing else. + + OpenStack used to use null-merges to bring final release + tags from stable branches back into the master branch. This + confuses the regular traversal because it makes that stable + branch appear to be part of master and/or the later stable + branch. This option allows us to ignore those. + """)), + + Opt('ignore_notes', [], + textwrap.dedent("""\ + Note files to be ignored. It's useful to be able to ignore a + file if it is edited on the wrong branch. Notes should be + specified by their filename or UID. + + Setting the option in the main configuration file makes it + apply to all branches. To ignore a note in the HTML build, use + the ``ignore-notes`` parameter to the ``release-notes`` sphinx + directive. + """)), +] + - # The name of the prelude section in the note template. This - # allows users to rename the section to, for example, - # 'release_summary' or 'project_wide_general_announcements', - # which is displayed in titlecase in the report after - # replacing underscores with spaces. - 'prelude_section_name': defaults.PRELUDE_SECTION_NAME, - - # When this option is set to True, any merge commits with no - # changes and in which the second or later parent is tagged - # are considered "null-merges" that bring the tag information - # into the current branch but nothing else. - # - # OpenStack used to use null-merges to bring final release - # tags from stable branches back into the master branch. This - # confuses the regular traversal because it makes that stable - # branch appear to be part of master and/or the later stable - # branch. This option allows us to ignore those. - 'ignore_null_merges': True, - - # Note files to be ignored. It's useful to be able to ignore a - # file if it is edited on the wrong branch. Notes should be - # specified by their filename or UID. Setting the value in the - # configuration file makes it apply to all branches. - 'ignore_notes': [], - } +class Config(object): + + _OPTS = {o.name: o for o in _OPTIONS} @classmethod def get_default(cls, opt): "Return the default for an option." try: - return cls._OPTS[opt] + return cls._OPTS[opt].default except KeyError: raise ValueError('unknown option name %r' % (opt,)) @@ -134,7 +196,7 @@ relnotesdir = defaults.RELEASE_NOTES_SUBDIR self.relnotesdir = relnotesdir # Initialize attributes from the defaults. - self.override(**self._OPTS) + self.override(**{o.name: o.default for o in _OPTIONS}) self._contents = {} self._load_file() @@ -145,6 +207,7 @@ os.path.join(self.reporoot, 'reno.yaml')] for filename in filenames: + LOG.debug('looking for configuration file %s', filename) if os.path.isfile(filename): break else: @@ -154,6 +217,7 @@ try: with open(filename, 'r') as fd: self._contents = yaml.safe_load(fd) + LOG.info('loaded configuration file %s', filename) except IOError as err: LOG.warning('did not load config file %s: %s', filename, err) else: @@ -161,7 +225,7 @@ def _rename_prelude_section(self, **kwargs): key = 'prelude_section_name' - if key in kwargs and kwargs[key] != self._OPTS[key]: + if key in kwargs and kwargs[key] != self._OPTS[key].default: new_prelude_name = kwargs[key] self.template = defaults.TEMPLATE.format(new_prelude_name) @@ -192,9 +256,9 @@ """ arg_values = { - o: getattr(parsed_args, o) - for o in self._OPTS.keys() - if hasattr(parsed_args, o) + o.name: getattr(parsed_args, o.name) + for o in _OPTIONS + if hasattr(parsed_args, o.name) } self.override(**arg_values) @@ -224,7 +288,10 @@ Returns the actual configuration options after overrides. """ - options = {o: getattr(self, o) for o in self._OPTS} + options = { + o.name: getattr(self, o.name) + for o in _OPTIONS + } return options # def parse_config_into(parsed_arguments): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/main.py new/reno-2.7.0/reno/main.py --- old/reno-2.6.0/reno/main.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/reno/main.py 2018-02-01 02:12:11.000000000 +0100 @@ -191,12 +191,13 @@ do_linter.set_defaults(func=linter.lint_cmd) args = parser.parse_args(argv) - conf = config.Config(args.reporoot, args.relnotesdir) - conf.override_from_parsed_args(args) logging.basicConfig( level=args.verbosity, format='%(message)s', ) + conf = config.Config(args.reporoot, args.relnotesdir) + conf.override_from_parsed_args(args) + return args.func(args, conf) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/scanner.py new/reno-2.7.0/reno/scanner.py --- old/reno-2.6.0/reno/scanner.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/reno/scanner.py 2018-02-01 02:12:11.000000000 +0100 @@ -513,6 +513,11 @@ self.conf.branch_name_re, flags=re.VERBOSE | re.UNICODE, ) + self.branch_name_prefix = self.conf.branch_name_prefix + self.closed_branch_tag_re = re.compile( + self.conf.closed_branch_tag_re, + flags=re.VERBOSE | re.UNICODE, + ) self._ignore_uids = set( _get_unique_id(fn) for fn in self.conf.ignore_notes @@ -818,6 +823,18 @@ elif r.startswith('refs/heads/'): name = r[11:] if name and self.branch_name_re.search(name): + LOG.debug('branch name %s', name) + branch_names.add(name) + continue + if not r.startswith('refs/tags/'): + continue + # See if the ref is a closed branch tag. + name = r.rpartition('/')[-1] + match = self.closed_branch_tag_re.search(name) + if match: + name = self.branch_name_prefix + match.group(1) + LOG.debug('closed branch tag %s becomes %s', + r.rpartition('/')[-1], name) branch_names.add(name) return list(sorted(branch_names)) @@ -912,9 +929,14 @@ collapse_pre_releases = self.conf.collapse_pre_releases stop_at_branch_base = self.conf.stop_at_branch_base - LOG.info('scanning %s/%s (branch=%s earliest_version=%s)', - reporoot.rstrip('/'), notesdir.lstrip('/'), - branch or '*current*', earliest_version) + LOG.info( + ('scanning %s/%s ' + '(branch=%s earliest_version=%s collapse_pre_releases=%s)'), + reporoot.rstrip('/'), notesdir.lstrip('/'), + branch or '*current*', + earliest_version, + collapse_pre_releases, + ) # Determine the current version, which might be an unreleased or # dev version if there are unreleased commits at the head of the @@ -982,6 +1004,7 @@ # base of the branch, which involves a bit of searching. LOG.debug('determining earliest_version from branch') branch_base = self._get_branch_base(branch) + LOG.debug('branch base %s', branch_base) scan_stop_tag = self._find_scan_stop_point( branch_base, versions_by_date, collapse_pre_releases, branch) @@ -990,6 +1013,8 @@ else: idx = versions_by_date.index(scan_stop_tag) earliest_version = versions_by_date[idx - 1] + LOG.debug('using version before %s as scan stop point', + scan_stop_tag) if earliest_version and collapse_pre_releases: if self.pre_release_tag_re.search(earliest_version): # The earliest version won't actually be the pre-release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/tests/test_config.py new/reno-2.7.0/reno/tests/test_config.py --- old/reno-2.6.0/reno/tests/test_config.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/reno/tests/test_config.py 2018-02-01 02:12:11.000000000 +0100 @@ -37,7 +37,11 @@ def test_defaults(self): c = config.Config(self.tempdir.path) actual = c.options - self.assertEqual(config.Config._OPTS, actual) + expected = { + o.name: o.default + for o in config._OPTIONS + } + self.assertEqual(expected, actual) def test_override(self): c = config.Config(self.tempdir.path) @@ -45,8 +49,10 @@ collapse_pre_releases=False, ) actual = c.options - expected = {} - expected.update(config.Config._OPTS) + expected = { + o.name: o.default + for o in config._OPTIONS + } expected['collapse_pre_releases'] = False self.assertEqual(expected, actual) @@ -59,8 +65,10 @@ notesdir='value2', ) actual = c.options - expected = {} - expected.update(config.Config._OPTS) + expected = { + o.name: o.default + for o in config._OPTIONS + } expected['notesdir'] = 'value2' self.assertEqual(expected, actual) @@ -108,18 +116,24 @@ def test_override_from_parsed_args_empty(self): c = self._run_override_from_parsed_args([]) actual = { - o: getattr(c, o) - for o in config.Config._OPTS.keys() + o.name: getattr(c, o.name) + for o in config._OPTIONS } - self.assertEqual(config.Config._OPTS, actual) + expected = { + o.name: o.default + for o in config._OPTIONS + } + self.assertEqual(expected, actual) def test_override_from_parsed_args(self): c = self._run_override_from_parsed_args([ '--no-collapse-pre-releases', ]) actual = c.options - expected = {} - expected.update(config.Config._OPTS) + expected = { + o.name: o.default + for o in config._OPTIONS + } expected['collapse_pre_releases'] = False self.assertEqual(expected, actual) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/tests/test_exts.py new/reno-2.7.0/reno/tests/test_exts.py --- old/reno-2.6.0/reno/tests/test_exts.py 1970-01-01 01:00:00.000000000 +0100 +++ new/reno-2.7.0/reno/tests/test_exts.py 2018-02-01 02:12:11.000000000 +0100 @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- + +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# 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. + +import textwrap + +from reno._exts import show_reno_config +from reno import config +from reno.tests import base + + +class TestMultiLineString(base.TestCase): + + def test_no_indent(self): + input = textwrap.dedent("""\ + The notes subdirectory within the relnotesdir where the + notes live. + """) + expected = '\n'.join([ + 'The notes subdirectory within the relnotesdir where the', + 'notes live.', + ]) + actual = '\n'.join(show_reno_config._multi_line_string(input)) + self.assertEqual(expected, actual) + + def test_with_indent(self): + input = textwrap.dedent("""\ + The notes subdirectory within the relnotesdir where the + notes live. + """) + expected = '\n'.join([ + ' The notes subdirectory within the relnotesdir where the', + ' notes live.', + ]) + actual = '\n'.join(show_reno_config._multi_line_string(input, ' ')) + self.assertEqual(expected, actual) + + def test_first_line_blank(self): + input = textwrap.dedent(""" + The notes subdirectory within the relnotesdir where the + notes live. + """) + expected = '\n'.join([ + ' The notes subdirectory within the relnotesdir where the', + ' notes live.', + ]) + actual = '\n'.join(show_reno_config._multi_line_string(input, ' ')) + self.assertEqual(expected, actual) + + +class TestFormatOptionHelp(base.TestCase): + + def test_simple_default(self): + opt = config.Opt( + 'notesdir', 'path/to/notes', + textwrap.dedent("""\ + The notes subdirectory within the relnotesdir where the + notes live. + """), + ) + actual = '\n'.join(show_reno_config._format_option_help([opt])) + expected = textwrap.dedent("""\ + ``notesdir`` + The notes subdirectory within the relnotesdir where the + notes live. + + Defaults to ``'path/to/notes'`` + """) + self.assertEqual(expected, actual) + + def test_bool_default(self): + opt = config.Opt( + 'collapse_pre_releases', True, + textwrap.dedent("""\ + Should pre-release versions be merged into the final release + of the same number (1.0.0.0a1 notes appear under 1.0.0). + """), + ) + actual = '\n'.join(show_reno_config._format_option_help([opt])) + expected = textwrap.dedent("""\ + ``collapse_pre_releases`` + Should pre-release versions be merged into the final release + of the same number (1.0.0.0a1 notes appear under 1.0.0). + + Defaults to ``True`` + """) + self.assertEqual(expected, actual) + + def test_multiline_default(self): + opt = config.Opt( + 'release_tag_re', + textwrap.dedent('''\ + ((?:[\d.ab]|rc)+) # digits, a, b, and rc cover regular and + # pre-releases + '''), + textwrap.dedent("""\ + The regex pattern used to match the repo tags representing a + valid release version. The pattern is compiled with the + verbose and unicode flags enabled. + """), + ) + actual = '\n'.join(show_reno_config._format_option_help([opt])) + expected = textwrap.dedent("""\ + ``release_tag_re`` + The regex pattern used to match the repo tags representing a + valid release version. The pattern is compiled with the + verbose and unicode flags enabled. + + Defaults to + + :: + + ((?:[\d.ab]|rc)+) # digits, a, b, and rc cover regular and + # pre-releases + """) + self.assertEqual(expected, actual) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno/tests/test_scanner.py new/reno-2.7.0/reno/tests/test_scanner.py --- old/reno-2.6.0/reno/tests/test_scanner.py 2017-11-16 10:32:31.000000000 +0100 +++ new/reno-2.7.0/reno/tests/test_scanner.py 2018-02-01 02:12:11.000000000 +0100 @@ -2389,3 +2389,53 @@ set(), self.changes.uniqueids_deleted, ) + + +class GetSeriesBranchesTest(Base): + + def setUp(self): + super(GetSeriesBranchesTest, self).setUp() + self.repo.add_file('test.txt') + + def test_none(self): + self.scanner = scanner.Scanner(self.c) + self.assertEqual( + [], + self.scanner._get_series_branches(), + ) + + def test_real_branches_sorted_names(self): + self.repo.git( + 'checkout', '-b', 'stable/a', + ) + self.repo.git( + 'checkout', '-b', 'stable/b', + ) + self.scanner = scanner.Scanner(self.c) + self.assertEqual( + ['stable/a', 'stable/b'], + self.scanner._get_series_branches(), + ) + + def test_eol_tag(self): + self.repo.git( + 'tag', '-s', '-m', 'closed branch', 'a-eol', + ) + self.scanner = scanner.Scanner(self.c) + self.assertEqual( + ['stable/a'], + self.scanner._get_series_branches(), + ) + + def test_mix_tag_and_branch(self): + self.repo.git( + 'tag', '-s', '-m', 'closed branch', 'a-eol', + ) + self.repo.git( + 'checkout', '-b', 'stable/b', + ) + self.scanner = scanner.Scanner(self.c) + self.assertEqual( + ['stable/a', 'stable/b'], + self.scanner._get_series_branches(), + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno.egg-info/PKG-INFO new/reno-2.7.0/reno.egg-info/PKG-INFO --- old/reno-2.6.0/reno.egg-info/PKG-INFO 2017-11-16 10:33:40.000000000 +0100 +++ new/reno-2.7.0/reno.egg-info/PKG-INFO 2018-02-01 02:14:43.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: reno -Version: 2.6.0 +Version: 2.7.0 Summary: RElease NOtes manager Home-page: https://docs.openstack.org/reno/latest/ Author: OpenStack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno.egg-info/SOURCES.txt new/reno-2.7.0/reno.egg-info/SOURCES.txt --- old/reno-2.6.0/reno.egg-info/SOURCES.txt 2017-11-16 10:33:40.000000000 +0100 +++ new/reno-2.7.0/reno.egg-info/SOURCES.txt 2018-02-01 02:14:43.000000000 +0100 @@ -26,6 +26,7 @@ doc/source/user/usage.rst examples/notes/add-complex-example-6b5927c246456896.yaml releasenotes/notes/Enable-using-tempalte-file-be734d8698309409.yaml +releasenotes/notes/add-closed-branch-config-options-8773caf240e4653f.yaml releasenotes/notes/add-config-file-e77084792c1dc695.yaml releasenotes/notes/add-deprecations-section-6b0f118fe190585c.yaml releasenotes/notes/add-earliest-version-6f3d634770e855d0.yaml @@ -91,11 +92,14 @@ reno.egg-info/pbr.json reno.egg-info/requires.txt reno.egg-info/top_level.txt +reno/_exts/__init__.py +reno/_exts/show_reno_config.py reno/tests/__init__.py reno/tests/base.py reno/tests/test_cache.py reno/tests/test_config.py reno/tests/test_create.py +reno/tests/test_exts.py reno/tests/test_formatter.py reno/tests/test_loader.py reno/tests/test_scanner.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reno-2.6.0/reno.egg-info/pbr.json new/reno-2.7.0/reno.egg-info/pbr.json --- old/reno-2.6.0/reno.egg-info/pbr.json 2017-11-16 10:33:40.000000000 +0100 +++ new/reno-2.7.0/reno.egg-info/pbr.json 2018-02-01 02:14:43.000000000 +0100 @@ -1 +1 @@ -{"git_version": "9d058ae", "is_release": true} \ No newline at end of file +{"git_version": "b9cf9a7", "is_release": true} \ No newline at end of file