Added tool to scan project repo for new bug fixes in master

The tool can be used to track new bug fixes landing in master to
consider them for inclusion in stable branches.

Usage example:

$ bugs-fixed-since.py --start 3fc84e3b536332406c05a549e4a741b5ffdd72a6

Output:

1537924
1549394

It also works with tags:

$ bugs-fixed-since.py --repo ../nova --start 13.0.0

Change-Id: I33c4ca6fc2efbd3703f81adb3a76e40516d004ad
This commit is contained in:
Ihar Hrachyshka 2016-03-23 12:39:26 +01:00
parent 3ae7f20170
commit d336f4133c
3 changed files with 76 additions and 0 deletions

View File

@ -878,3 +878,13 @@ Example::
The tool looks for all of the changes in the project that you have a -2 vote on
and changes your vote to 0, with the message "This project is now open for new
features."
bugs-fixed-since.py
-------------------
List bugs mentioned in master commit messages starting from a specified commit.
Example::
./bugs-fixed-since.py -r ../neutron --start=8.0.0

65
bugs-fixed-since.py Executable file
View File

@ -0,0 +1,65 @@
#!/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
#
# 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.
"""
This tool will list bugs that were fixed in project master.
"""
import argparse
import re
from git import Repo
BUG_PATTERN = r'Bug:\s+#?(?P<bugnum>\d+)'
def _parse_args():
parser = argparse.ArgumentParser(
description='List bugs with recent fixes.')
parser.add_argument(
'--repo', '-r',
default='.',
help='path to the openstack project repository',
)
parser.add_argument(
'--start', '-s', required=True,
help='git hash to start search from')
return parser.parse_args()
def main():
args = _parse_args()
repo = Repo(args.repo)
# make sure that we work with the latest code
repo.remotes.origin.fetch()
latest = repo.refs['origin/master'].commit
rev = '%s..%s' % (args.start, latest.hexsha)
# avoid duplicates
bugs = set()
for commit in repo.iter_commits(rev):
for match in re.finditer(BUG_PATTERN, commit.message):
bugs.add(match.group('bugnum'))
for bug in bugs:
print(bug)
if __name__ == '__main__':
main()

View File

@ -11,3 +11,4 @@ zuul
simplejson>=2.2.0
reno>=0.1.1
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
GitPython>=1.0.1 # BSD License (3 clause)