* 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.
This commit is contained in:
Daniel Holbach 2011-05-23 15:49:06 +02:00
parent 2d4683260b
commit f8abc5b881
2 changed files with 28 additions and 11 deletions

View File

@ -34,6 +34,16 @@ def error_out(msg):
Logger.error(msg) Logger.error(msg)
sys.exit(1) 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(): def main():
usage = "Usage: %prog <bug number>" usage = "Usage: %prog <bug number>"
opt_parser = OptionParser(usage) opt_parser = OptionParser(usage)
@ -61,18 +71,18 @@ def main():
bug = launchpad.bugs[args[0]] bug = launchpad.bugs[args[0]]
except HTTPError, error: except HTTPError, error:
if error.response.status == 401: if error.response.status == 401:
error_out("E: Don't have enough permissions to access bug %s" % args[0]) error_out("E: Don't have enough permissions to access bug %s. %s" % \
error_out(error.content) (args[0], error.content))
else: else:
raise raise
if 'bitesize' not in bug.tags: if 'bitesize' in bug.tags:
bug.tags += ['bitesize'] error_out("Bug is already marked as 'bitesize'.")
content = """I'm marking this bug as 'bitesize' as it looks like an issue bug.newMessage(content="I'm marking this bug as 'bitesize' as it looks "
that is easy to fix and suitable for newcomers in Ubuntu development. If you "like an issue that is easy to fix and suitable "
need any help with fixing it, talk to me (https://launchpad.net/~%s) about "for newcomers in Ubuntu development. If you need "
it.""" % (launchpad.me.name) "any help with fixing it, talk to me about it.")
bug.newMessage(content=content, subject="bitesize bug") bug.subscribe(person=launchpad.me)
bug.lp_save() tag_bug(launchpad.bugs[bug.id]) # fresh bug object, LP: #336866 workaround
if __name__ == '__main__': if __name__ == '__main__':
main() main()

9
debian/changelog vendored
View File

@ -7,7 +7,14 @@ ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
[ Mackenzie Morgan ] [ Mackenzie Morgan ]
* Add debhelper and quilt as recommends (LP: #786370) * Add debhelper and quilt as recommends (LP: #786370)
-- Mackenzie Morgan <maco.m@ubuntu.com> 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 <daniel.holbach@ubuntu.com> Mon, 23 May 2011 15:47:04 +0200
ubuntu-dev-tools (0.123) unstable; urgency=low ubuntu-dev-tools (0.123) unstable; urgency=low