~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bugtracker.py

  • Committer: Martin Pool
  • Date: 2010-08-18 07:25:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5383.
  • Revision ID: mbp@sourcefrog.net-20100818072522-uk3gsazoia3l3s0a
Start adding 'what's new in 2.3'

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
--fixes`` to mark bugs in that tracker as being fixed by that commit. For
94
94
example::
95
95
 
96
 
    bugzilla_squid_url = http://bugs.squid-cache.org
 
96
    bugzilla_squid_url = http://www.squid-cache.org/bugs
97
97
 
98
98
would allow ``bzr commit --fixes squid:1234`` to mark Squid's bug 1234 as
99
99
fixed.
127
127
 
128
128
    bugtracker_cpan_url = http://rt.cpan.org/Public/Bug/Display.html?id={id}
129
129
 
130
 
would allow ``bzr commit --fixes cpan:1234`` to mark bug 1234 in CPAN's
131
 
RT bug tracker as fixed, or::
132
 
 
133
 
    bugtracker_hudson_url = http://issues.hudson-ci.org/browse/{id}
134
 
 
135
 
would allow ``bzr commit --fixes hudson:HUDSON-1234`` to mark bug HUDSON-1234
136
 
in Hudson's JIRA bug tracker as fixed.
 
130
for CPAN's RT bug tracker.
137
131
"""
138
132
 
139
133
 
231
225
 
232
226
 
233
227
tracker_registry.register('gnome',
234
 
    UniqueIntegerBugTracker('gnome',
235
 
                            'http://bugzilla.gnome.org/show_bug.cgi?id='))
236
 
 
237
 
 
238
 
class URLParametrizedBugTracker(BugTracker):
 
228
    UniqueIntegerBugTracker('gnome', 'http://bugzilla.gnome.org/show_bug.cgi?id='))
 
229
 
 
230
 
 
231
class URLParametrizedIntegerBugTracker(IntegerBugTracker):
239
232
    """A type of bug tracker that can be found on a variety of different sites,
240
233
    and thus needs to have the base URL configured.
241
234
 
242
235
    Looks for a config setting in the form '<type_name>_<abbreviation>_url'.
243
 
    `type_name` is the name of the type of tracker and `abbreviation`
244
 
    is a short name for the particular instance.
 
236
    `type_name` is the name of the type of tracker (e.g. 'bugzilla' or 'trac')
 
237
    and `abbreviation` is a short name for the particular instance (e.g.
 
238
    'squid' or 'apache').
245
239
    """
246
240
 
247
241
    def get(self, abbreviation, branch):
248
242
        config = branch.get_config()
249
243
        url = config.get_user_option(
250
 
            "%s_%s_url" % (self.type_name, abbreviation), expand=False)
 
244
            "%s_%s_url" % (self.type_name, abbreviation))
251
245
        if url is None:
252
246
            return None
253
247
        self._base_url = url
262
256
        return urlutils.join(self._base_url, self._bug_area) + str(bug_id)
263
257
 
264
258
 
265
 
class URLParametrizedIntegerBugTracker(IntegerBugTracker,
266
 
                                       URLParametrizedBugTracker):
267
 
    """A type of bug tracker that  only allows integer bug IDs.
268
 
 
269
 
    This can be found on a variety of different sites, and thus needs to have
270
 
    the base URL configured.
271
 
 
272
 
    Looks for a config setting in the form '<type_name>_<abbreviation>_url'.
273
 
    `type_name` is the name of the type of tracker (e.g. 'bugzilla' or 'trac')
274
 
    and `abbreviation` is a short name for the particular instance (e.g.
275
 
    'squid' or 'apache').
276
 
    """
277
 
 
278
259
tracker_registry.register(
279
260
    'trac', URLParametrizedIntegerBugTracker('trac', 'ticket/'))
280
261
 
283
264
    URLParametrizedIntegerBugTracker('bugzilla', 'show_bug.cgi?id='))
284
265
 
285
266
 
286
 
class GenericBugTracker(URLParametrizedBugTracker):
 
267
class GenericBugTracker(URLParametrizedIntegerBugTracker):
287
268
    """Generic bug tracker specified by an URL template."""
288
269
 
289
270
    def __init__(self):