1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect1 id="tgit-dug-bugtracker">
\r
4 <?dbhh topicname="HIDD_SETTINGSBUGTRAQ_CONFIG"?>
\r
5 <title>Integration with Bug Tracking Systems / Issue Trackers</title>
\r
7 <primary>bug tracking</primary>
\r
10 <primary>bug tracker</primary>
\r
13 <primary>issue tracker</primary>
\r
16 <primary>bugtracker</primary>
\r
19 It is very common in Software Development for changes to be related to a specific
\r
20 bug or issue ID. Users of bug tracking systems (issue trackers) would like to associate
\r
21 the changes they make in Git with a specific ID in their issue tracker.
\r
22 Most issue trackers therefore provide a pre-commit hook script which parses the log
\r
23 message to find the bug ID with which the commit is associated.
\r
24 This is somewhat error prone since it relies on the user to write the log message
\r
25 properly so that the pre-commit hook script can parse it correctly.
\r
28 TortoiseGit can help the user in two ways:
\r
32 When the user enters a log message, a well defined line including
\r
33 the issue number associated with the commit can be added automatically.
\r
34 This reduces the risk that the user enters the issue number in a way
\r
35 the bug tracking tools can't parse correctly.
\r
38 Or TortoiseGit can highlight the part of
\r
39 the entered log message which is recognized by the issue tracker.
\r
40 That way the user knows that the log message can be parsed correctly.
\r
45 When the user browses the log messages, TortoiseGit
\r
46 creates a link out of each bug ID in the log message which fires
\r
47 up the browser to the issue mentioned.
\r
52 <sect2 id="tgit-dug-bugtracker-link">
\r
53 <title>Adding Issue Numbers to Log Messages</title>
\r
55 You can integrate a bug tracking tool of your choice in
\r
56 TortoiseGit. To do this, you have to define
\r
57 some configuration, which start with <literal>bugtraq.</literal>.
\r
58 These settings can be edited using TortoiseGit settings dialog: <xref linkend="tgit-dug-settings-hooks-issuetracker-config"/>
\r
61 There are two ways to integrate TortoiseGit with issue trackers. One is
\r
62 based on simple strings, the other is based on
\r
63 <emphasis>regular expressions</emphasis>.
\r
64 The configuration used by both approaches are:
\r
67 <term condition="pot">bugtraq.url</term>
\r
70 Set this configuration to the URL of your bug tracking tool.
\r
71 It must be properly URI encoded and it has to contain
\r
72 <literal>%BUGID%</literal>.
\r
73 <literal>%BUGID%</literal> is replaced with the Issue number
\r
74 you entered. This allows TortoiseGit
\r
75 to display a link in the log dialog, so when you are looking
\r
76 at the revision log you can jump directly to your
\r
78 You do not have to provide this configuration, but then
\r
79 TortoiseGit shows only the
\r
80 issue number and not the link to it.
\r
81 e.g the TortoiseGit project is using
\r
82 <systemitem class="url">https://code.google.com/p/tortoisegit/issues/detail?id=%BUGID%</systemitem>
\r
87 <term condition="pot">bugtraq.warnifnoissue</term>
\r
90 Set this to <literal>true</literal>, if you want
\r
91 TortoiseGit to warn you
\r
92 because of an empty issue-number text field. Valid values
\r
93 are <literal>true/false</literal>.
\r
95 If not defined, <literal>false</literal> is assumed.
\r
102 <sect3 id="tgit-dug-bugtracker-link-simple">
\r
103 <title>Issue Number in Text Box</title>
\r
105 In the simple approach, TortoiseGit shows the user a separate
\r
106 input field where a bug ID can be entered. Then a separate line
\r
107 is appended/prepended to the log message the user entered.
\r
110 <term condition="pot">bugtraq.message</term>
\r
113 This configuration activates the bug tracking system
\r
114 in <emphasis>Input field</emphasis> mode.
\r
115 If this configuration is set, then TortoiseGit
\r
116 will prompt you to enter an issue number when you commit
\r
117 your changes. It's used to add a line at the end of the
\r
118 log message. It must contain
\r
119 <literal>%BUGID%</literal>, which is replaced with the
\r
120 issue number on commit. This ensures that your commit log
\r
121 contains a reference to the issue number which is always
\r
122 in a consistent format and can be parsed by your
\r
123 bug tracking tool to associate the issue number with a
\r
124 particular commit. As an example you might use
\r
125 <literal>Issue : %BUGID%</literal>,
\r
126 but this depends on your Tool.
\r
131 <term condition="pot">bugtraq.append</term>
\r
134 This configuration defines if the bug-ID is appended (true)
\r
135 to the end of the log message or inserted (false) at the
\r
136 start of the log message. Valid values are
\r
137 <literal>true/false</literal>.
\r
139 If not defined, <literal>true</literal> is assumed,
\r
140 so that existing projects don't break.
\r
146 <term condition="pot">bugtraq.label</term>
\r
149 This text is shown by TortoiseGit
\r
150 on the commit dialog to label the edit box where you enter
\r
151 the issue number. If it's not set,
\r
152 <literal>Bug-ID / Issue-Nr:</literal> will be displayed.
\r
153 Keep in mind though that the window will not be resized
\r
154 to fit this label, so keep the size of the label below
\r
160 <term condition="pot">bugtraq.number</term>
\r
163 If set to <literal>true</literal> only numbers are allowed
\r
164 in the issue-number text field.
\r
165 An exception is the comma, so you can comma separate several
\r
166 numbers. Valid values are <literal>true/false</literal>.
\r
168 If not defined, <literal>true</literal> is assumed.
\r
176 <sect3 id="tgit-dug-bugtracker-link-regex">
\r
177 <title>Issue Numbers Using Regular Expressions</title>
\r
179 In the approach with <emphasis>regular expressions</emphasis>, TortoiseGit
\r
180 doesn't show a separate input field but marks the part of the log message
\r
181 the user enters which is recognized by the issue tracker. This is done while
\r
182 the user writes the log message. This also means that the bug ID can be
\r
183 anywhere inside a log message! This method is much more flexible, and is
\r
184 the one used by the TortoiseGit project itself.
\r
187 <term condition="pot">bugtraq.logregex</term>
\r
190 This configuration activates the bug tracking system
\r
191 in <emphasis>Regex</emphasis> mode.
\r
192 It contains either a single regular expressions,
\r
193 or two regular expressions separated by a newline.
\r
196 If two expressions are set, then the first expression is used as
\r
197 a pre-filter to find expressions which contain bug IDs. The
\r
198 second expression then extracts the bare bug IDs from the
\r
199 result of the first regex. This allows you to use a list
\r
200 of bug IDs and natural language expressions if you wish.
\r
201 e.g. you might fix several bugs and include a string something
\r
203 <quote>This change resolves issues #23, #24 and #25</quote>
\r
206 If you want to catch bug IDs as used in the expression above
\r
207 inside a log message, you could use the following regex strings,
\r
208 which are the ones used by the TortoiseGit project:
\r
209 <literal>[Ii]ssues?:?(\s*(,|and)?\s*#\d+)+</literal> and
\r
210 <literal>(\d+)</literal>
\r
213 The first expression picks out <quote>issues #23, #24 and #25</quote>
\r
214 from the surrounding log message.
\r
215 The second regex extracts plain decimal numbers from the output
\r
216 of the first regex, so it will return <quote>23</quote>, <quote>24</quote>
\r
217 and <quote>25</quote> to use as bug IDs.
\r
220 Breaking the first regex down a little, it must start with
\r
221 the word <quote>issue</quote>, possibly capitalised.
\r
222 This is optionally followed by an <quote>s</quote> (more than one
\r
223 issue) and optionally a colon. This is followed by one or more
\r
224 groups each having zero or more leading whitespace, an optional
\r
225 comma or <quote>and</quote> and more optional space. Finally there
\r
226 is a mandatory <quote>#</quote> and a mandatory decimal number.
\r
229 If only one expression is set, then the bare bug IDs must be
\r
230 matched in the groups of the regex string. Example:
\r
231 <literal>[Ii]ssue(?:s)? #?(\d+)</literal>
\r
232 This method is required by a few issue trackers, e.g. trac,
\r
233 but it is harder to construct the regex. We recommend that you
\r
234 only use this method if your issue tracker documentation
\r
238 If you are unfamiliar with regular expressions, take a look at
\r
239 the introduction at
\r
240 <ulink url="https://en.wikipedia.org/wiki/Regular_expression">
\r
241 <citetitle>https://en.wikipedia.org/wiki/Regular_expression</citetitle>
\r
243 and the online documentation and tutorial at
\r
244 <ulink url="http://www.regular-expressions.info/">
\r
245 <citetitle>http://www.regular-expressions.info/</citetitle>
\r
254 If both the <literal>bugtraq:message</literal> and <literal>bugtraq:logregex</literal>
\r
255 properties are set, <literal>logregex</literal> takes precedence.
\r
259 Even if you don't have an issue tracker with a pre-commit hook parsing your
\r
260 log messages, you still can use this to turn the issues mentioned in your
\r
261 log messages into links!
\r
264 And even if you don't need the links, the issue numbers show up as a
\r
265 separate column in the log dialog, making it easier to find the changes
\r
266 which relate to a particular issue.
\r
269 <sect3 id="tgit-dug-bugtracker-link-provider">
\r
270 <title>Issue Tracker Provider Settings based on Hierarchical Git Configuration</title>
\r
272 This is a hierarchical git configuration to associate issue tracker plugin with your project,
\r
273 rather than with to a specific directory path. Such settings are more portable.
\r
274 To deploy the settings, set to Project level and commit <literal>.tgitconfig</literal>.
\r
277 <term condition="pot">bugtraq.provideruuid</term>
\r
280 This is the GUID of 32-bit issue tracker plugin.
\r
285 <term condition="pot">bugtraq.provideruuid64</term>
\r
288 This is the GUID of 64-bit issue tracker plugin.
\r
293 <term condition="pot">bugtraq.providerparams</term>
\r
296 This is the parameter string for the issue tracker plugin.
\r
304 This issue tracker integration is not restricted to TortoiseGit; it can be used
\r
305 with other clients (e.g. TortoiseSVN). For more information, read the full
\r
306 <ulink url="https://tortoisegit.googlecode.com/git/doc/issuetrackers.txt">
\r
307 <citetitle>Issue Tracker Integration Specification</citetitle>
\r
309 in the TortoiseGit source repository.
\r
310 (<xref linkend="tgit-preface-source"/> explains how to access the repository).
\r
313 <sect2 id="tgit-dug-bugtracker-ref">
\r
314 <title>Getting Information from the Issue Tracker</title>
\r
316 The previous section deals with adding issue information to the
\r
317 log messages. But what if you need to get information from the issue
\r
318 tracker? The commit dialog has a Windows COM interface which allows
\r
319 integration an external program that can talk to your tracker.
\r
320 Typically you might want to query the tracker to get a list of
\r
321 open issues assigned to you, so that you can pick the issues that
\r
322 are being addressed in this commit.
\r
325 Any such interface is of course highly specific to your system,
\r
326 so we cannot provide this part, and describing how to create such a
\r
327 program is beyond the scope of this manual. The interface definition
\r
328 and sample programs can be obtained from the <literal>contrib</literal>
\r
330 <ulink url="https://code.google.com/p/tortoisegit/source/browse/#git%2Fcontrib%2Fissue-tracker-plugins">
\r
331 <citetitle>TortoiseGit repository</citetitle>
\r
333 (<xref linkend="tgit-preface-source"/> explains how to access the repository).
\r
334 A summary of the API is also given in <xref linkend="tgit-ibugtraqprovider"/>
\r
336 Another (working) example plugin in C# is
\r
337 <ulink url="https://code.google.com/p/gurtle/">
\r
338 <citetitle>Gurtle</citetitle>
\r
340 which implements the required COM interface to interact with the
\r
341 <ulink url="https://code.google.com/hosting/">
\r
342 <citetitle>Google Code</citetitle>
\r
347 For illustration purposes, let's suppose that your system administrator
\r
348 has provided you with an issue tracker plugin which you have installed,
\r
349 and that you have set up some of your working trees to use the plugin
\r
350 in TortoiseGit's settings dialog.
\r
351 When you open the commit dialog from a working tree to which the plugin
\r
352 has been assigned, you will see a new button at the top of the dialog.
\r
353 <figure id="tgit-dug-bugtracker-dia-1">
\r
354 <title>Example issue tracker query dialog</title>
\r
355 <graphic fileref="../images/IssueTrackerQuery.png"/>
\r
357 In this example you can select one or more open issues. The plugin
\r
358 can then generate specially formatted text which it adds to your log
\r