From 6a848de2bb7621c9050eecd888ad61ca7149116b Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 30 Aug 2009 11:52:16 -0400 Subject: Add a method to update a bug Add Bug.update() to allow changing fields in an existing bug. (adding comments, setting the status/resolution, etc.) --- git-bz | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/git-bz b/git-bz index 792d0b7..09bf72d 100755 --- a/git-bz +++ b/git-bz @@ -977,6 +977,25 @@ class Bug(object): print "Attached %s" % filename + # Update specified fields of a bug; keyword arguments are interpreted + # as field_name=value + def update(self, **changes): + changes['id'] = str(self.id) + changes['token'] = self.token + # Since we don't send delta_ts we'll never get a mid-air collision + # This is probably a good thing + + response = self.server.send_post("/process_bug.cgi", changes) + response_data = response.read() + if not check_for_success(response, response_data, + r"\s*Bug[\S\s]*processed\s*"): + + # Mid-air collisions would be indicated by + # "Mid-air collision!" + + print response_data + die ("Failed to update bug %d, status=%d" % (self.id, response.status)) + def get_url(self): return "%s://%s/show_bug.cgi?id=%d" % ("https" if self.server.https else "http", self.server.host, -- cgit v1.2.3