From f8abc5b881ab950556533075cd960336ffc6e184 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Mon, 23 May 2011 15:49:06 +0200 Subject: [PATCH 1/3] * bitesize: - display error message properly. - error out if bug is already marked as 'bitesize'. - rephrase bug comment and subscribe person who adds the comment. - work-around LP:336866 and LP:254901. --- bitesize | 30 ++++++++++++++++++++---------- debian/changelog | 9 ++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/bitesize b/bitesize index edaa09a..09935dd 100755 --- a/bitesize +++ b/bitesize @@ -34,6 +34,16 @@ def error_out(msg): Logger.error(msg) sys.exit(1) +def save_entry(entry): + try: + entry.lp_save() + except HTTPError, error: + print 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) @@ -61,18 +71,18 @@ def main(): bug = launchpad.bugs[args[0]] except HTTPError, error: if error.response.status == 401: - error_out("E: Don't have enough permissions to access bug %s" % args[0]) - error_out(error.content) + error_out("E: Don't have enough permissions to access bug %s. %s" % \ + (args[0], error.content)) else: raise - if 'bitesize' not in bug.tags: - bug.tags += ['bitesize'] - 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 (https://launchpad.net/~%s) about -it.""" % (launchpad.me.name) - bug.newMessage(content=content, subject="bitesize bug") - bug.lp_save() + 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 --git a/debian/changelog b/debian/changelog index 9246240..8b4d3bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,7 +7,14 @@ ubuntu-dev-tools (0.124) UNRELEASED; urgency=low [ Mackenzie Morgan ] * Add debhelper and quilt as recommends (LP: #786370) - -- Mackenzie Morgan Sat, 21 May 2011 19:29:35 -0400 + [ Daniel Holbach ] + * bitesize: + - display error message properly. + - error out if bug is already marked as 'bitesize'. + - rephrase bug comment and subscribe person who adds the comment. + - work-around LP:336866 and LP:254901. + + -- Daniel Holbach Mon, 23 May 2011 15:47:04 +0200 ubuntu-dev-tools (0.123) unstable; urgency=low From 4e8a631483f441432b7c97db646c1ccaa4dfa4be Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Mon, 23 May 2011 17:29:32 +0200 Subject: [PATCH 2/3] remove 'E:', not needed --- bitesize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitesize b/bitesize index 09935dd..fd4c35d 100755 --- a/bitesize +++ b/bitesize @@ -71,7 +71,7 @@ def main(): bug = launchpad.bugs[args[0]] except HTTPError, error: if error.response.status == 401: - error_out("E: Don't have enough permissions to access bug %s. %s" % \ + error_out("Don't have enough permissions to access bug %s. %s" % \ (args[0], error.content)) else: raise From 29307e456691f6b1e5591b80f85817797c06d665 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Mon, 23 May 2011 17:51:18 +0200 Subject: [PATCH 3/3] on an error saving, error out properly --- bitesize | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitesize b/bitesize index fd4c35d..a170843 100755 --- a/bitesize +++ b/bitesize @@ -38,7 +38,7 @@ def save_entry(entry): try: entry.lp_save() except HTTPError, error: - print error.content + error_out(error.content) def tag_bug(bug): bug.tags = bug.tags + ['bitesize'] # LP: #254901 workaround