~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bugtracker.py

  • Committer: Jonathan Lange
  • Date: 2007-04-20 03:40:09 UTC
  • mto: This revision was merged to the branch mainline in revision 2446.
  • Revision ID: jml@canonical.com-20070420034009-ii53ulxxwj1jnppt
Support for Bugzilla bug trackers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
        return urlutils.join(self._url, 'ticket', bug_id)
153
153
 
154
154
tracker_registry.register('trac', TracTracker)
 
155
 
 
156
 
 
157
 
 
158
class BugzillaTracker(object):
 
159
    """A Bugzilla instance."""
 
160
 
 
161
    @classmethod
 
162
    def get(klass, abbreviated_bugtracker_name, branch):
 
163
        config = branch.get_config()
 
164
        url = config.get_user_option(
 
165
            'bugzilla_%s_url' % (abbreviated_bugtracker_name,))
 
166
        if url is None:
 
167
            return None
 
168
        return klass(url)
 
169
 
 
170
    def __init__(self, base_url):
 
171
        self._base_url = base_url
 
172
 
 
173
    def get_bug_url(self, bug_id):
 
174
        try:
 
175
            int(bug_id)
 
176
        except ValueError:
 
177
            raise errors.MalformedBugIdentifier(bug_id, "Must be an integer")
 
178
        return "%s/show_bug.cgi?id=%s" % (self._base_url, bug_id)