~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bugtracker.py

  • Committer: Aaron Bentley
  • Date: 2007-12-09 23:53:50 UTC
  • mto: This revision was merged to the branch mainline in revision 3133.
  • Revision ID: aaron.bentley@utoronto.ca-20071209235350-qp39yk0xzx7a4f6p
Don't use the base if not cherrypicking

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
"""
40
40
 
41
41
 
42
 
_bugs_help = \
43
 
"""When making a commit, metadata about bugs fixed by that change can be
44
 
recorded by using the --fixes option. For each bug marked as fixed, an
45
 
entry is included in the 'bugs' revision property stating '<url> <status>'.
46
 
(The only ``status`` value currently supported is ``fixed.``)
47
 
Support for Launchpad's central bug tracker is built in. For other bug
48
 
trackers, configuration is required in advance so that the correct URL
49
 
can be recorded.
50
 
 
51
 
In addition to Launchpad, Bazaar directly supports the generation of
52
 
URLs appropriate for Bugzilla and Trac. If your project uses a different
53
 
bug tracker, it is easy to add support for it.
54
 
If you use Bugzilla or Trac, then you only need to set a configuration
55
 
variable which contains the base URL of the bug tracker. These options
56
 
can go into ``bazaar.conf``, ``branch.conf`` or into a branch-specific
57
 
configuration section in ``locations.conf``.  You can set up these values
58
 
for each of the projects you work on.
59
 
 
60
 
Note: As you provide a short name for each tracker, you can specify one or
61
 
more bugs in one or more trackers at commit time if you wish.
62
 
 
63
 
Launchpad
64
 
---------
65
 
 
66
 
Use ``bzr commit --fixes lp:2`` to record that this commit fixes bug 2.
67
 
 
68
 
bugzilla_<tracker_abbreviation>_url
69
 
-----------------------------------
70
 
 
71
 
If present, the location of the Bugzilla bug tracker referred to by
72
 
<tracker_abbreviation>. This option can then be used together with ``bzr commit
73
 
--fixes`` to mark bugs in that tracker as being fixed by that commit. For
74
 
example::
75
 
 
76
 
    bugzilla_squid_url = http://www.squid-cache.org/bugs
77
 
 
78
 
would allow ``bzr commit --fixes squid:1234`` to mark Squid's bug 1234 as
79
 
fixed.
80
 
 
81
 
trac_<tracker_abbrevation>_url
82
 
------------------------------
83
 
 
84
 
If present, the location of the Trac instance referred to by
85
 
<tracker_abbreviation>. This option can then be used together with ``bzr commit
86
 
--fixes`` to mark bugs in that tracker as being fixed by that commit. For
87
 
example::
88
 
 
89
 
    trac_twisted_url = http://www.twistedmatrix.com/trac
90
 
 
91
 
would allow ``bzr commit --fixes twisted:1234`` to mark Twisted's bug 1234 as
92
 
fixed.
93
 
 
94
 
bugtracker_<tracker_abbrevation>_url
95
 
------------------------------------
96
 
 
97
 
If present, the location of a generic bug tracker instance referred to by
98
 
<tracker_abbreviation>. The location must contain an ``{id}`` placeholder,
99
 
which will be replaced by a specific bug ID. This option can then be used
100
 
together with ``bzr commit --fixes`` to mark bugs in that tracker as being
101
 
fixed by that commit. For example::
102
 
 
103
 
    bugtracker_python_url = http://bugs.python.org/issue{id}
104
 
 
105
 
would allow ``bzr commit --fixes python:1234`` to mark bug 1234 in Python's
106
 
Roundup bug tracker as fixed, or::
107
 
 
108
 
    bugtracker_cpan_url = http://rt.cpan.org/Public/Bug/Display.html?id={id}
109
 
 
110
 
for CPAN's RT bug tracker.
111
 
"""
112
 
 
113
 
 
114
42
def get_bug_url(abbreviated_bugtracker_name, branch, bug_id):
115
43
    """Return a URL pointing to the canonical web page of the bug identified by
116
44
    'bug_id'.
137
65
                                                   branch)
138
66
 
139
67
    def help_topic(self, topic):
140
 
        return _bugs_help
 
68
        return textwrap.dedent("""\
 
69
        Bazaar provides the ability to store information about bugs being fixed
 
70
        as metadata on a revision.
 
71
 
 
72
        For each bug marked as fixed, an entry is included in the 'bugs'
 
73
        revision property stating '<url> <status>'.
 
74
        """)
141
75
 
142
76
 
143
77
tracker_registry = TrackerRegistry()
176
110
    """A style of bug tracker that exists in one place only, such as Launchpad.
177
111
 
178
112
    If you have one of these trackers then register an instance passing in an
179
 
    abbreviated name for the bug tracker and a base URL. The bug ids are
180
 
    appended directly to the URL.
 
113
    abbreviated name for the bug tracker and a base URL.
181
114
    """
182
115
 
183
116
    def __init__(self, abbreviated_bugtracker_name, base_url):
193
126
 
194
127
    def _get_bug_url(self, bug_id):
195
128
        """Return the URL for bug_id."""
196
 
        return self.base_url + bug_id
 
129
        return urlutils.join(self.base_url, bug_id)
197
130
 
198
131
 
199
132
tracker_registry.register(
204
137
    'debian', UniqueIntegerBugTracker('deb', 'http://bugs.debian.org/'))
205
138
 
206
139
 
207
 
tracker_registry.register('gnome',
208
 
    UniqueIntegerBugTracker('gnome', 'http://bugzilla.gnome.org/show_bug.cgi?id='))
209
 
 
210
 
 
211
140
class URLParametrizedIntegerBugTracker(IntegerBugTracker):
212
141
    """A type of bug tracker that can be found on a variety of different sites,
213
142
    and thus needs to have the base URL configured.