diff -Nru ubuntu-dev-tools-0.122.1/bitesize ubuntu-dev-tools-0.122.1+bitesize~natty1/bitesize --- ubuntu-dev-tools-0.122.1/bitesize 1970-01-01 01:00:00.000000000 +0100 +++ ubuntu-dev-tools-0.122.1+bitesize~natty1/bitesize 2011-05-24 09:34:23.000000000 +0200 @@ -0,0 +1,88 @@ +#!/usr/bin/python +"""Add 'bitesize' tag to bugs and add a comment.""" + +# Copyright (c) 2011 Canonical Ltd. +# +# bitesize is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) any +# later version. +# +# bitesize is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with bitesize; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# Authors: +# Daniel Holbach + +import sys +from optparse import OptionParser + +from launchpadlib.launchpad import Launchpad +from launchpadlib.errors import HTTPError + +from ubuntutools.logger import Logger +from ubuntutools.config import UDTConfig + +def error_out(msg): + Logger.error(msg) + sys.exit(1) + +def save_entry(entry): + try: + entry.lp_save() + except HTTPError, error: + error_out(error.content) + +def tag_bug(bug): + bug.tags = bug.tags + ['bitesize'] # LP: #254901 workaround + save_entry(bug) + +def main(): + usage = "Usage: %prog " + opt_parser = OptionParser(usage) + opt_parser.add_option("-l", "--lpinstance", metavar="INSTANCE", + help="Launchpad instance to connect to " + "(default: production)", + dest="lpinstance", default=None) + opt_parser.add_option("--no-conf", + help="Don't read config files or " + "environment variables.", + dest="no_conf", default=False, action="store_true") + (options, args) = opt_parser.parse_args() + config = UDTConfig(options.no_conf) + if options.lpinstance is None: + options.lpinstance = config.get_value("LPINSTANCE") + if len(args) < 1: + opt_parser.error("Need at least one bug number.") + + launchpad = Launchpad.login_with("ubuntu-dev-tools", options.lpinstance) + if launchpad is None: + error_out("Couldn't authenticate to Launchpad.") + + # check that the new main bug isn't a duplicate + try: + bug = launchpad.bugs[args[0]] + except HTTPError, error: + if error.response.status == 401: + error_out("Don't have enough permissions to access bug %s. %s" % \ + (args[0], error.content)) + else: + raise + if 'bitesize' in bug.tags: + error_out("Bug is already marked as 'bitesize'.") + bug.newMessage(content="I'm marking this bug as 'bitesize' as it looks " + "like an issue that is easy to fix and suitable " + "for newcomers in Ubuntu development. If you need " + "any help with fixing it, talk to me about it.") + bug.subscribe(person=launchpad.me) + tag_bug(launchpad.bugs[bug.id]) # fresh bug object, LP: #336866 workaround + +if __name__ == '__main__': + main() diff -Nru ubuntu-dev-tools-0.122.1/debian/changelog ubuntu-dev-tools-0.122.1+bitesize~natty1/debian/changelog --- ubuntu-dev-tools-0.122.1/debian/changelog 2011-05-20 21:19:50.000000000 +0200 +++ ubuntu-dev-tools-0.122.1+bitesize~natty1/debian/changelog 2011-05-24 09:42:56.000000000 +0200 @@ -1,3 +1,11 @@ +ubuntu-dev-tools (0.122.1+bitesize~natty1) natty-backports; urgency=low + + * bitesize, doc/bitesize.1, debian/copyright, setup.py: take bitesize script + from current trunk. (LP: #787383) + * bitesize: revert r1087, so we avoid pulling in a newer devscripts. + + -- Daniel Holbach Tue, 24 May 2011 09:28:26 +0200 + ubuntu-dev-tools (0.122.1) natty-proposed; urgency=low * sponsor-patch: Fix assertion error if a relative working directory diff -Nru ubuntu-dev-tools-0.122.1/debian/copyright ubuntu-dev-tools-0.122.1+bitesize~natty1/debian/copyright --- ubuntu-dev-tools-0.122.1/debian/copyright 2011-05-20 21:06:17.000000000 +0200 +++ ubuntu-dev-tools-0.122.1+bitesize~natty1/debian/copyright 2011-05-24 09:25:17.000000000 +0200 @@ -86,6 +86,8 @@ version 2 can be found in the /usr/share/common-licenses/GPL-2 file. Files: ack-sync + bitesize + doc/bitesize.1 doc/edit-patch.1 doc/get-branches.1 doc/grab-attachments.1 diff -Nru ubuntu-dev-tools-0.122.1/doc/bitesize.1 ubuntu-dev-tools-0.122.1+bitesize~natty1/doc/bitesize.1 --- ubuntu-dev-tools-0.122.1/doc/bitesize.1 1970-01-01 01:00:00.000000000 +0100 +++ ubuntu-dev-tools-0.122.1+bitesize~natty1/doc/bitesize.1 2011-05-24 09:23:55.000000000 +0200 @@ -0,0 +1,54 @@ +.TH bitesize "1" "May 9 2010" "ubuntu-dev-tools" +.SH NAME +bitesize \- Add \fBbitesize\fR tag to bugs and add a comment. + +.SH SYNOPSIS +.B bitesize \fR<\fIbug number\fR> +.br +.B bitesize \-\-help + +.SH DESCRIPTION +\fBbitesize\fR adds a bitesize tag to the bug, if it's not there yet. It +also adds a comment to the bug indicating that you are willing to help with +fixing it. +It checks for permission to operate on a given bug first, +then perform required tasks on Launchpad. + +.SH OPTIONS +Listed below are the command line options for \fBbitesize\fR: +.TP +.BR \-h ", " \-\-help +Display a help message and exit. +.TP +.B \-l \fIINSTANCE\fR, \fB\-\-lpinstance\fR=\fIINSTANCE\fR +Use the specified instance of Launchpad (e.g. "staging"), instead of +the default of "production". +.TP +.B \-\-no\-conf +Do not read any configuration files, or configuration from environment +variables. + +.SH ENVIRONMENT +All of the \fBCONFIGURATION VARIABLES\fR below are also supported as +environment variables. +Variables in the environment take precedence to those in configuration +files. + +.SH CONFIGURATION VARIABLES +The following variables can be set in the environment or in +.BR ubuntu\-dev\-tools (5) +configuration files. +In each case, the script\-specific variable takes precedence over the +package\-wide variable. +.TP +.BR BITESIZE_LPINSTANCE ", " UBUNTUTOOLS_LPINSTANCE +The default value for \fB--lpinstance\fR. + +.SH SEE ALSO +.BR ubuntu\-dev\-tools (5) + +.SH AUTHORS +\fBbitesize\fR and this manual page were written by Daniel Holbach +. +.PP +Both are released under the terms of the GNU General Public License, version 3. diff -Nru ubuntu-dev-tools-0.122.1/setup.py ubuntu-dev-tools-0.122.1+bitesize~natty1/setup.py --- ubuntu-dev-tools-0.122.1/setup.py 2011-05-20 21:06:17.000000000 +0200 +++ ubuntu-dev-tools-0.122.1+bitesize~natty1/setup.py 2011-05-24 09:24:08.000000000 +0200 @@ -15,6 +15,7 @@ scripts = ['404main', 'backportpackage', + 'bitesize', 'check-mir', 'check-symbols', 'dch-repeat',