~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bugtracker.py

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

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://www.squid-cache.org/bugs
 
96
    bugzilla_squid_url = http://bugs.squid-cache.org
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
 
for CPAN's RT bug tracker.
 
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.
131
137
"""
132
138
 
133
139
 
225
231
 
226
232
 
227
233
tracker_registry.register('gnome',
228
 
    UniqueIntegerBugTracker('gnome', 'http://bugzilla.gnome.org/show_bug.cgi?id='))
229
 
 
230
 
 
231
 
class URLParametrizedIntegerBugTracker(IntegerBugTracker):
 
234
    UniqueIntegerBugTracker('gnome',
 
235
                            'http://bugzilla.gnome.org/show_bug.cgi?id='))
 
236
 
 
237
 
 
238
class URLParametrizedBugTracker(BugTracker):
232
239
    """A type of bug tracker that can be found on a variety of different sites,
233
240
    and thus needs to have the base URL configured.
234
241
 
235
242
    Looks for a config setting in the form '<type_name>_<abbreviation>_url'.
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').
 
243
    `type_name` is the name of the type of tracker and `abbreviation`
 
244
    is a short name for the particular instance.
239
245
    """
240
246
 
241
247
    def get(self, abbreviation, branch):
242
248
        config = branch.get_config()
243
249
        url = config.get_user_option(
244
 
            "%s_%s_url" % (self.type_name, abbreviation))
 
250
            "%s_%s_url" % (self.type_name, abbreviation), expand=False)
245
251
        if url is None:
246
252
            return None
247
253
        self._base_url = url
256
262
        return urlutils.join(self._base_url, self._bug_area) + str(bug_id)
257
263
 
258
264
 
 
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
 
259
278
tracker_registry.register(
260
279
    'trac', URLParametrizedIntegerBugTracker('trac', 'ticket/'))
261
280
 
264
283
    URLParametrizedIntegerBugTracker('bugzilla', 'show_bug.cgi?id='))
265
284
 
266
285
 
267
 
class GenericBugTracker(URLParametrizedIntegerBugTracker):
 
286
class GenericBugTracker(URLParametrizedBugTracker):
268
287
    """Generic bug tracker specified by an URL template."""
269
288
 
270
289
    def __init__(self):