This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| hgbuzilla [2014/06/01 20:08] – created jim | hgbuzilla [2014/06/01 20:12] (current) – jim | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| In 4.4.3, Bugzilla changes the way it authenticates use of the API. This breaks the Bugzilla extension distributed with Mercurial versions 3.0 and prior. | In 4.4.3, Bugzilla changes the way it authenticates use of the API. This breaks the Bugzilla extension distributed with Mercurial versions 3.0 and prior. | ||
| - | For Mercurial 3.0, this patch will get things working again. | + | For Mercurial 3.0, this patch will get things working again. It should be part of Mercurial 3.1 and later. |
| + | < | ||
| + | --- a/ | ||
| + | +++ b/ | ||
| + | @@ -1,7 +1,7 @@ | ||
| + | # bugzilla.py - bugzilla integration for mercurial | ||
| + | # | ||
| + | # Copyright 2006 Vadim Gelfer < | ||
| + | -# Copyright 2011-2 Jim Hague < | ||
| + | +# Copyright 2011-4 Jim Hague < | ||
| + | # | ||
| + | # This software may be used and distributed according to the terms of the | ||
| + | # GNU General Public License version 2 or any later version. | ||
| + | @@ -232,7 +232,7 @@ | ||
| + | | ||
| + | | ||
| + | | ||
| + | - version=xmlrpc | ||
| + | + version=xmlrpc+email | ||
| + | | ||
| + | | ||
| + | {hgweb}/ | ||
| + | @@ -523,7 +523,7 @@ | ||
| + | |||
| + | The regular xmlrpclib transports ignore cookies. Which causes | ||
| + | a bit of a problem when you need a cookie-based login, as with | ||
| + | - the Bugzilla XMLRPC interface. | ||
| + | + the Bugzilla XMLRPC interface prior to 4.4.3. | ||
| + | |||
| + | So this is a helper for defining a Transport which looks for | ||
| + | | ||
| + | @@ -620,7 +620,9 @@ | ||
| + | ver = self.bzproxy.Bugzilla.version()[' | ||
| + | | ||
| + | | ||
| + | - self.bzproxy.User.login({' | ||
| + | + login = self.bzproxy.User.login({' | ||
| + | + ' | ||
| + | + self.bztoken = login.get(' | ||
| + | |||
| + | def transport(self, | ||
| + | if urlparse.urlparse(uri, | ||
| + | @@ -631,13 +633,15 @@ | ||
| + | def get_bug_comments(self, | ||
| + | """ | ||
| + | c = self.bzproxy.Bug.comments({' | ||
| + | - ' | ||
| + | + ' | ||
| + | + ' | ||
| + | | ||
| + | |||
| + | def filter_real_bug_ids(self, | ||
| + | probe = self.bzproxy.Bug.get({' | ||
| + | ' | ||
| + | ' | ||
| + | + ' | ||
| + | }) | ||
| + | for badbug in probe[' | ||
| + | id = badbug[' | ||
| + | @@ -662,6 +666,7 @@ | ||
| + | if ' | ||
| + | | ||
| + | | ||
| + | + args[' | ||
| + | | ||
| + | else: | ||
| + | if ' | ||
| + | @@ -719,10 +724,12 @@ | ||
| + | than the subject line, and leave a blank line after it. | ||
| + | ''' | ||
| + | user = self.map_committer(committer) | ||
| + | - matches = self.bzproxy.User.get({' | ||
| + | + matches = self.bzproxy.User.get({' | ||
| + | + ' | ||
| + | if not matches[' | ||
| + | user = self.ui.config(' | ||
| + | - matches = self.bzproxy.User.get({' | ||
| + | + matches = self.bzproxy.User.get({' | ||
| + | + ' | ||
| + | if not matches[' | ||
| + | raise util.Abort(_(" | ||
| + | user) | ||
| + | </ | ||
| + | For older versions of Mercurial, this patch is equivalent, but will apply without errors. | ||
| + | |||
| + | < | ||
| + | --- hgext/ | ||
| + | +++ hgext/ | ||
| + | @@ -620,7 +620,9 @@ | ||
| + | ver = self.bzproxy.Bugzilla.version()[' | ||
| + | | ||
| + | | ||
| + | - self.bzproxy.User.login(dict(login=user, | ||
| + | + login = self.bzproxy.User.login(dict(login=user, | ||
| + | + | ||
| + | + self.bztoken = login.get(' | ||
| + | |||
| + | def transport(self, | ||
| + | if urlparse.urlparse(uri, | ||
| + | @@ -630,12 +632,14 @@ | ||
| + | |||
| + | def get_bug_comments(self, | ||
| + | """ | ||
| + | - c = self.bzproxy.Bug.comments(dict(ids=[id], | ||
| + | + c = self.bzproxy.Bug.comments(dict(ids=[id], | ||
| + | + | ||
| + | | ||
| + | |||
| + | def filter_real_bug_ids(self, | ||
| + | probe = self.bzproxy.Bug.get(dict(ids=sorted(bugs.keys()), | ||
| + | | ||
| + | + token=self.bztoken, | ||
| + | | ||
| + | for badbug in probe[' | ||
| + | id = badbug[' | ||
| + | @@ -660,6 +664,7 @@ | ||
| + | if ' | ||
| + | | ||
| + | | ||
| + | + args[' | ||
| + | | ||
| + | else: | ||
| + | if ' | ||
| + | @@ -717,10 +722,10 @@ | ||
| + | than the subject line, and leave a blank line after it. | ||
| + | ''' | ||
| + | user = self.map_committer(committer) | ||
| + | - matches = self.bzproxy.User.get(dict(match=[user])) | ||
| + | + matches = self.bzproxy.User.get(dict(match=[user], | ||
| + | if not matches[' | ||
| + | user = self.ui.config(' | ||
| + | - matches = self.bzproxy.User.get(dict(match=[user])) | ||
| + | + matches = self.bzproxy.User.get(dict(match=[user], | ||
| + | if not matches[' | ||
| + | raise util.Abort(_(" | ||
| + | user) | ||
| + | </ | ||