diff --git a/README.rst b/README.rst index 64e9513..173176d 100644 --- a/README.rst +++ b/README.rst @@ -898,7 +898,7 @@ importance specified. Filtering out Wishlist bugs if importance not specified. Example:: - ./bugs-fixed-since.py --start=8.0.0 | \ + ./bugs-fixed-since.py [...] --start=8.0.0 | \ ./lp-filter-bugs-by-importance.py neutron List bugs that are fixed in master since 8.0.0 that are not of Wishlist @@ -922,7 +922,7 @@ a tag specified. Example:: - ./bugs-fixed-since.py --start=8.0.0 | \ + ./bugs-fixed-since.py [...] --start=8.0.0 | \ ./lp-filter-bugs-by-tag.py neutron --tag in-stable-mitaka List bugs that are fixed in master since 8.0.0 that don't have relevant fixes @@ -937,7 +937,7 @@ detailed description for each of them. Example:: - ./bugs-fixed-since.py --start=8.0.0 | ./annotate-lp-bugs neutron + ./bugs-fixed-since.py [...] --start=8.0.0 | ./annotate-lp-bugs neutron Pull in detailed description for bugs that are fixed in master since 8.0.0. @@ -950,3 +950,15 @@ Clean up <*>-backport-potential tags for bugs with in-stable-<*> tag set. Example:: ./lp-reset-backport-potential.py neutron python-neutronclient + + +lp-tag.py +--------- + +Append a tag to bugs specified on stdin. + +Example:: + + ./bugs-fixed-since.py [...] --start=8.0.0 | ./lp-tag.py foo-tag + +This command will add the 'foo-tag' tag to all bugs fixed since 8.0.0. diff --git a/lp-tag.py b/lp-tag.py new file mode 100755 index 0000000..9e021ef --- /dev/null +++ b/lp-tag.py @@ -0,0 +1,48 @@ +#!/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 Launchpad tool is used to tag bugs with a tag. +""" + +import argparse +import sys + +from launchpadlib.launchpad import Launchpad + + +def _parse_args(): + parser = argparse.ArgumentParser( + description='Tag tags with a tag.') + parser.add_argument( + 'tag', help='Tag to use') + return parser.parse_args() + + +def main(): + args = _parse_args() + lp = Launchpad.login_with('openstack-releasing', 'production') + bugnums = [line.strip() for line in sys.stdin.readlines()] + for bugnum in bugnums: + bug = lp.bugs[bugnum] + tag = args.tag + tags = bug.tags + if tag not in tags: + tags.append(tag) + bug.tags = tags + bug.lp_save() + + +if __name__ == '__main__': + main()