1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect2 id="tsvn-dug-settings-hooks">
\r
4 <title>Client Side Hook Scripts</title>
\r
5 <?dbhh topicname="HIDD_SETTINGSHOOKS"?>
\r
6 <?dbhh topicname="HIDD_SETTINGSHOOKCONFIG"?>
\r
9 <primary>client hooks</primary>
\r
12 <primary>hook scripts</primary>
\r
15 <figure id="tsvn-dug-settings-dia-hooks">
\r
16 <title>The Settings Dialog, Hook Scripts Page</title>
\r
17 <graphic fileref="../images/SettingsHooks.png"/>
\r
19 This dialog allows you to set up hook scripts which will be
\r
20 executed automatically when certain Git actions are performed.
\r
21 As opposed to the hook scripts explained in <xref linkend="tsvn-repository-hooks"/>,
\r
22 these scripts are executed locally on the client.
\r
25 One application for such hooks might be to call a program like
\r
26 <literal>SubWCRev.exe</literal> to update version numbers after a commit,
\r
27 and perhaps to trigger a rebuild.
\r
30 For various security and implementation reasons, hook scripts are defined
\r
31 locally on a machine, rather than as project properties. You define what
\r
32 happens, no matter what someone else commits to the repository. Of course
\r
33 you can always choose to call a script which is itself under version control.
\r
36 <figure id="tsvn-dug-settings-dia-hook-edit">
\r
37 <title>The Settings Dialog, Configure Hook Scripts</title>
\r
38 <graphic fileref="../images/SettingsHookEdit.png"/>
\r
40 To add a new hook script, simply click <guibutton>Add</guibutton>
\r
41 and fill in the details.
\r
44 There are currently six types of hook script available
\r
47 <term>Start-commit</term>
\r
50 Called before the commit dialog is shown.
\r
51 You might want to use this if the hook modifies a versioned
\r
52 file and affects the list of files that need to be committed
\r
53 and/or commit message. However you should note that because
\r
54 the hook is called at an early stage, the full list of objects
\r
55 selected for commit is not available.
\r
60 <term>Pre-commit</term>
\r
63 Called after the user clicks <guibutton>OK</guibutton>
\r
64 in the commit dialog, and before the actual commit begins.
\r
65 This hook has a list of exactly what will be committed.
\r
70 <term>Post-commit</term>
\r
73 Called after the commit finishes (whether successful or not).
\r
78 <term>Start-update</term>
\r
81 Called before the update-to-revision dialog is shown.
\r
86 <term>Pre-update</term>
\r
89 Called before the actual Git update begins.
\r
94 <term>Post-update</term>
\r
97 Called after the update finishes (whether successful or not).
\r
104 A hook is defined for a particular working tree path. You only need to
\r
105 specify the top level path; if you perform an operation in a sub-folder,
\r
106 TortoiseGit will automatically search upwards for a matching path.
\r
109 Next you must specify the command line to execute, starting with the path
\r
110 to the hook script or executable.
\r
111 This could be a batch file, an executable file or any other file which
\r
112 has a valid windows file association, eg. a perl script.
\r
115 The command line includes several parameters which get filled in
\r
116 by TortoiseGit. The parameters passed depend upon which hook is called.
\r
117 Each hook has its own parameters which are passed in the following order:
\r
120 <term>Start-commit</term>
\r
121 <listitem condition="pot">
\r
123 <literal>PATH</literal>
\r
124 <literal>MESSAGEFILE</literal>
\r
125 <literal>CWD</literal>
\r
130 <term>Pre-commit</term>
\r
131 <listitem condition="pot">
\r
133 <literal>PATH</literal>
\r
134 <literal>DEPTH</literal>
\r
135 <literal>MESSAGEFILE</literal>
\r
136 <literal>CWD</literal>
\r
141 <term>Post-commit</term>
\r
142 <listitem condition="pot">
\r
144 <literal>PATH</literal>
\r
145 <literal>DEPTH</literal>
\r
146 <literal>MESSAGEFILE</literal>
\r
147 <literal>REVISION</literal>
\r
148 <literal>ERROR</literal>
\r
149 <literal>CWD</literal>
\r
154 <term>Start-update</term>
\r
155 <listitem condition="pot">
\r
157 <literal>PATH</literal>
\r
158 <literal>CWD</literal>
\r
163 <term>Pre-update</term>
\r
164 <listitem condition="pot">
\r
166 <literal>PATH</literal>
\r
167 <literal>DEPTH</literal>
\r
168 <literal>REVISION</literal>
\r
169 <literal>CWD</literal>
\r
174 <term>Post-update</term>
\r
175 <listitem condition="pot">
\r
177 <literal>PATH</literal>
\r
178 <literal>DEPTH</literal>
\r
179 <literal>REVISION</literal>
\r
180 <literal>ERROR</literal>
\r
181 <literal>CWD</literal>
\r
188 The meaning of each of these parameters is described here:
\r
191 <term condition="pot">PATH</term>
\r
194 A path to a temporary file which contains all the
\r
195 paths for which the operation was started.
\r
196 Each path is on a separate line in the temp file.
\r
201 <term condition="pot">DEPTH</term>
\r
204 The depth with which the commit/update is done.
\r
207 Possible values are:
\r
210 <term condition="pot">-2</term>
\r
213 <literal>svn_depth_unknown</literal>
\r
218 <term condition="pot">-1</term>
\r
221 <literal>svn_depth_exclude</literal>
\r
226 <term condition="pot">0</term>
\r
229 <literal>svn_depth_empty</literal>
\r
234 <term condition="pot">1</term>
\r
237 <literal>svn_depth_files</literal>
\r
242 <term condition="pot">2</term>
\r
245 <literal>svn_depth_immediates</literal>
\r
250 <term condition="pot">3</term>
\r
253 <literal>svn_depth_infinity</literal>
\r
262 <term condition="pot">MESSAGEFILE</term>
\r
265 Path to a file containing the log message for
\r
266 the commit. The file contains the text in UTF-8
\r
267 encoding. After successful execution of the
\r
268 start-commit hook, the log message is read back,
\r
269 giving the hook a chance to modify it.
\r
274 <term condition="pot">REVISION</term>
\r
277 The repository revision to which the update should
\r
278 be done or after a commit completes.
\r
283 <term condition="pot">ERROR</term>
\r
286 Path to a file containing the error message.
\r
287 If there was no error, the file will be empty.
\r
292 <term condition="pot">CWD</term>
\r
295 The current working directory with which the script is run.
\r
296 This is set to the common root directory of all affected paths.
\r
303 Note that although we have given these parameters names for convenience,
\r
304 you do not have to refer to those names in the hook settings.
\r
305 All parameters listed for a particular hook are always passed,
\r
306 whether you want them or not ;-)
\r
309 If you want the Git operation to hold off until the hook has completed,
\r
310 check <guilabel>Wait for the script to finish</guilabel>.
\r
313 Normally you will want to hide ugly DOS boxes when the script runs,
\r
314 so <guilabel>Hide the script while running</guilabel> is checked by default.
\r
317 Sample client hook scripts can be found in the <literal>contrib</literal> folder in the
\r
318 <ulink url="http://TortoiseGit.tigris.org/svn/TortoiseGit/trunk/contrib/hook-scripts">
\r
319 <citetitle>TortoiseGit repository</citetitle>
\r
321 (<xref linkend="tsvn-preface-source"/> explains how to access the repository).
\r
324 <sect3 id="tsvn-dug-settings-hooks-issuetracker">
\r
325 <title>Issue Tracker Integration</title>
\r
326 <?dbhh topicname="HIDD_SETTINGSBUGTRAQ"?>
\r
327 <?dbhh topicname="HIDD_SETTINGSBUGTRAQADV"?>
\r
329 TortoiseGit can use a COM plugin to query issue trackers when in the
\r
330 commit dialog. The use of such plugins is described in
\r
331 <xref linkend="tsvn-dug-bugtracker-ref" />.
\r
332 If your system administrator has provided you with a plugin, which
\r
333 you have already installed and registered, this is the place to
\r
334 specify how it integrates with your working tree.
\r
337 <figure id="tsvn-dug-settings-dia-issuetracker">
\r
338 <title>The Settings Dialog, Issue Tracker Integration Page</title>
\r
339 <graphic fileref="../images/SettingsIssueTracker.png"/>
\r
341 Click on <guibutton>Add...</guibutton> to use the plugin with
\r
342 a particular working tree. Here you can specify the working tree
\r
343 path, choose which plugin to use from a drop down list of all
\r
344 registered issue tracker plugins, and any parameters to pass.
\r
345 The parameters will be specific to the plugin, but might include
\r
346 your user name on the issue tracker so that the plugin can
\r
347 query for issues which are assigned to you.
\r
350 <sect3 id="tsvn-dug-settings-hooks-issuetracker-config">
\r
351 <title>Config</title>
\r
352 <?dbhh topicname="HIDD_SETTINGSBUGTRAQ_CONFIG"?>
\r
354 <figure id="tsvn-dug-settings-hooks-issuetrack-config">
\r
355 <title>The Settings Dialog, issue track config</title>
\r
356 <graphic fileref="../images/SettingsIssueTrackerConfig.png"/>
\r