[python-bugzilla] Make closing bugs work, and allow closing as duplicate.

Adam Jackson ajax at fedoraproject.org
Thu Jan 3 15:49:04 UTC 2013


commit 762722e14736653f19c32d8ce2cb4fac596547b5
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu Jan 3 10:49:01 2013 -0500

    Make closing bugs work, and allow closing as duplicate.

 pybz-0.7.0-close-duplicate.patch |   56 ++++++++++++++++++++++++++++++++++++++
 pybz-0.7.0-rhbz-close.patch      |   47 +++++++++++++++++++++++++++++++
 python-bugzilla.spec             |   10 ++++++-
 3 files changed, 112 insertions(+), 1 deletions(-)
---
diff --git a/pybz-0.7.0-close-duplicate.patch b/pybz-0.7.0-close-duplicate.patch
new file mode 100644
index 0000000..b5fc0f0
--- /dev/null
+++ b/pybz-0.7.0-close-duplicate.patch
@@ -0,0 +1,56 @@
+From bfb5f4a17d5c49ec035beeaee613b118f90f30e8 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax at redhat.com>
+Date: Thu, 06 Dec 2012 15:54:32 +0000
+Subject: Wire up CLOSED/DUPLICATE support in the cli
+
+Also fix the parameter name we pass to the server for rhbz.
+
+Signed-off-by: Adam Jackson <ajax at redhat.com>
+---
+diff --git a/bin/bugzilla b/bin/bugzilla
+index 49e4a09..2c1a85e 100755
+--- a/bin/bugzilla
++++ b/bin/bugzilla
+@@ -202,6 +202,8 @@ def setup_action_parser(action):
+         # FIXME: check value for resolution
+         p.add_option('-k','--close',metavar="RESOLUTION",
+                 help='Close with the given resolution')
++        p.add_option('-d','--dupeid',metavar="ORIGINAL",
++                help='ID of original bug (implies -k DUPLICATE)')
+         p.add_option('-p','--private',action='store_true',default=False,
+                 help='Mark as private')
+         p.add_option('-s','--status',
+@@ -642,6 +644,9 @@ def main(bzinstance=None):
+             print "Created attachment %i on bug %s" % (attid, bugid)
+ 
+     elif action == 'modify':
++        if opt.dupeid is not None:
++            opt.close = "DUPLICATE"
++
+         if not (opt.status or opt.close or opt.assignee or opt.flag or opt.cc
+                 or opt.comment or opt.fixed_in):
+             parser.error("'modify' command requires additional arguments")
+@@ -673,7 +678,7 @@ def main(bzinstance=None):
+                 bug.setstatus(opt.status, opt.comment, private=opt.private)
+             elif opt.close:
+                 log.debug("  close %s" % opt.close)
+-                bug.close(opt.close,comment=opt.comment,isprivate=opt.private)
++                bug.close(opt.close,comment=opt.comment,isprivate=opt.private,dupeid=opt.dupeid)
+             elif opt.assignee:
+                 log.debug("  assignee %s" % opt.assignee)
+                 bug.setassignee(assigned_to=opt.assignee,comment=opt.comment)
+diff --git a/bugzilla/rhbugzilla.py b/bugzilla/rhbugzilla.py
+index c54dfa3..795d6ed 100644
+--- a/bugzilla/rhbugzilla.py
++++ b/bugzilla/rhbugzilla.py
+@@ -269,7 +269,7 @@ class RHBugzilla(Bugzilla4):
+         update={'bug_status':'CLOSED','resolution':resolution}
+         if dupeid:
+             update['resolution'] = 'DUPLICATE'
+-            update['dupe_id'] = dupeid
++            update['dupe_of'] = dupeid
+         if fixedin:
+             update['fixed_in'] = fixedin
+         if comment:
+--
+cgit v0.9.1
diff --git a/pybz-0.7.0-rhbz-close.patch b/pybz-0.7.0-rhbz-close.patch
new file mode 100644
index 0000000..9f6375f
--- /dev/null
+++ b/pybz-0.7.0-rhbz-close.patch
@@ -0,0 +1,47 @@
+From e7d9d7ee607c3b2b42898945a849fcc9cbdc3db2 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax at redhat.com>
+Date: Thu, 06 Dec 2012 15:28:06 +0000
+Subject: rhbugzilla: make closing bugs actually work
+
+As should be clear from the parameter list, _close_bug() can't possibly
+work as written (once you remember about 'self').  Even if you fix that,
+the proxy method being invoked there no longer exists on the server
+side:
+
+    Server error: <Fault Client: 'Failed to locate method (closeBug) in
+    class (Bugzilla::WebService::Bug) at
+    /usr/lib/perl5/vendor_perl/5.8.8/SOAP/Lite.pm line 2837.\n'>
+
+Fortunately some kind person had left the correct code behind a hash
+mark.
+
+Signed-off-by: Adam Jackson <ajax at redhat.com>
+---
+diff --git a/bugzilla/rhbugzilla.py b/bugzilla/rhbugzilla.py
+index b3ec9de..c54dfa3 100644
+--- a/bugzilla/rhbugzilla.py
++++ b/bugzilla/rhbugzilla.py
+@@ -242,11 +242,6 @@ class RHBugzilla(Bugzilla4):
+ 
+         return ret
+ 
+-    def _close_bug(id, updates):
+-        updates['id'] = id
+-
+-        return self._proxy.Bug.closeBug(updates)
+-
+     def _update_bug(self,id,updates):
+         '''Update a single bug, specified by integer ID or (string) bug alias.
+         Really just a convenience method for _update_bugs(ids=[id],updates)'''
+@@ -281,8 +276,7 @@ class RHBugzilla(Bugzilla4):
+             update['comment'] = comment
+             if isprivate:
+                 update['comment_is_private'] = True
+-        return self._close_bug(id, update)
+-        #return self._update_bug(id,update)
++        return self._update_bug(id, update)
+ 
+     def _setassignee(self,id,**data):
+         '''Raw xmlrpc call to set one of the assignee fields on a bug.
+--
+cgit v0.9.1
diff --git a/python-bugzilla.spec b/python-bugzilla.spec
index a901f09..41e9304 100644
--- a/python-bugzilla.spec
+++ b/python-bugzilla.spec
@@ -2,7 +2,7 @@
 
 Name:           python-bugzilla
 Version:        0.7.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        A python library for interacting with Bugzilla
 
 Group:          Development/Languages
@@ -10,6 +10,9 @@ License:        GPLv2+
 URL:            https://fedorahosted.org/python-bugzilla
 Source0:        https://fedorahosted.org/releases/p/y/%{name}/%{name}-%{version}.tar.gz
 
+Patch0:		pybz-0.7.0-close-duplicate.patch
+Patch1:		pybz-0.7.0-rhbz-close.patch
+
 BuildArch:      noarch
 BuildRequires:  python-devel
 BuildRequires: python-setuptools-devel
@@ -25,6 +28,8 @@ for interacting with bugzilla from shell scripts.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 
 
 %build
@@ -44,6 +49,9 @@ for interacting with bugzilla from shell scripts.
 
 
 %changelog
+* Thu Jan 03 2013 Adam Jackson <ajax at redhat.com> 0.7.0-3
+- Make closing bugs work, and allow closing as duplicate.
+
 * Sat Jul 21 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.7.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list