Log dialog can revert selected files to parent revision
[TortoiseGit.git] / doc / source / en / TortoiseGit / tsvn_dug / dug_settings_hooks.xml
blob12b9301192355e733e33a7ba5eac3f7911472482
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
7         <!--\r
8         <indexterm>\r
9                 <primary>client hooks</primary>\r
10         </indexterm>\r
11         <indexterm>\r
12                 <primary>hook scripts</primary>\r
13         </indexterm>\r
14         <para>\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
18                 </figure>\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
23         </para>\r
24         <para>\r
25                 For various security and implementation reasons, hook scripts are defined\r
26                 locally on a machine, rather than as project properties. You define what\r
27                 happens, no matter what someone else commits to the repository. Of course\r
28                 you can always choose to call a script which is itself under version control.\r
29         </para>\r
30         <para>\r
31                 <figure id="tsvn-dug-settings-dia-hook-edit">\r
32                         <title>The Settings Dialog, Configure Hook Scripts</title>\r
33                         <graphic fileref="../images/SettingsHookEdit.png"/>\r
34                 </figure>\r
35                 To add a new hook script, simply click <guibutton>Add</guibutton>\r
36                 and fill in the details.\r
37         </para>\r
38         <para>\r
39                 There are currently six types of hook script available\r
40                 <variablelist>\r
41                         <varlistentry>\r
42                                 <term>Start-commit</term>\r
43                                 <listitem>\r
44                                         <para>\r
45                                                 Called before the commit dialog is shown.\r
46                                                 You might want to use this if the hook modifies a versioned\r
47                                                 file and affects the list of files that need to be committed\r
48                                                 and/or commit message. However you should note that because\r
49                                                 the hook is called at an early stage, the full list of objects\r
50                                                 selected for commit is not available.\r
51                                         </para>\r
52                                 </listitem>\r
53                         </varlistentry>\r
54                         <varlistentry>\r
55                                 <term>Pre-commit</term>\r
56                                 <listitem>\r
57                                         <para>\r
58                                                 Called after the user clicks <guibutton>OK</guibutton>\r
59                                                 in the commit dialog, and before the actual commit begins.\r
60                                                 This hook has a list of exactly what will be committed.\r
61                                         </para>\r
62                                 </listitem>\r
63                         </varlistentry>\r
64                         <varlistentry>\r
65                                 <term>Post-commit</term>\r
66                                 <listitem>\r
67                                         <para>\r
68                                                 Called after the commit finishes (whether successful or not).\r
69                                         </para>\r
70                                 </listitem>\r
71                         </varlistentry>\r
72                         <varlistentry>\r
73                                 <term>Start-update</term>\r
74                                 <listitem>\r
75                                         <para>\r
76                                                 Called before the update-to-revision dialog is shown.\r
77                                         </para>\r
78                                 </listitem>\r
79                         </varlistentry>\r
80                         <varlistentry>\r
81                                 <term>Pre-update</term>\r
82                                 <listitem>\r
83                                         <para>\r
84                                                 Called before the actual Git update begins.\r
85                                         </para>\r
86                                 </listitem>\r
87                         </varlistentry>\r
88                         <varlistentry>\r
89                                 <term>Post-update</term>\r
90                                 <listitem>\r
91                                         <para>\r
92                                                 Called after the update finishes (whether successful or not).\r
93                                         </para>\r
94                                 </listitem>\r
95                         </varlistentry>\r
96                 </variablelist>\r
97         </para>\r
98         <para>\r
99                 A hook is defined for a particular working tree path. You only need to\r
100                 specify the top level path; if you perform an operation in a sub-folder,\r
101                 TortoiseGit will automatically search upwards for a matching path.\r
102         </para>\r
103         <para>\r
104                 Next you must specify the command line to execute, starting with the path\r
105                 to the hook script or executable.\r
106                 This could be a batch file, an executable file or any other file which\r
107                 has a valid windows file association, eg. a perl script.\r
108         </para>\r
109         <para>\r
110                 The command line includes several parameters which get filled in\r
111                 by TortoiseGit. The parameters passed depend upon which hook is called.\r
112                 Each hook has its own parameters which are passed in the following order:\r
113                 <variablelist>\r
114                         <varlistentry>\r
115                                 <term>Start-commit</term>\r
116                                 <listitem condition="pot">\r
117                                         <para>\r
118                                                 <literal>PATH</literal>\r
119                                                 <literal>MESSAGEFILE</literal>\r
120                                                 <literal>CWD</literal>\r
121                                         </para>\r
122                                 </listitem>\r
123                         </varlistentry>\r
124                         <varlistentry>\r
125                                 <term>Pre-commit</term>\r
126                                 <listitem condition="pot">\r
127                                         <para>\r
128                                                 <literal>PATH</literal>\r
129                                                 <literal>DEPTH</literal>\r
130                                                 <literal>MESSAGEFILE</literal>\r
131                                                 <literal>CWD</literal>\r
132                                         </para>\r
133                                 </listitem>\r
134                         </varlistentry>\r
135                         <varlistentry>\r
136                                 <term>Post-commit</term>\r
137                                 <listitem condition="pot">\r
138                                         <para>\r
139                                                 <literal>PATH</literal>\r
140                                                 <literal>DEPTH</literal>\r
141                                                 <literal>MESSAGEFILE</literal>\r
142                                                 <literal>REVISION</literal>\r
143                                                 <literal>ERROR</literal>\r
144                                                 <literal>CWD</literal>\r
145                                         </para>\r
146                                 </listitem>\r
147                         </varlistentry>\r
148                         <varlistentry>\r
149                                 <term>Start-update</term>\r
150                                 <listitem condition="pot">\r
151                                         <para>\r
152                                                 <literal>PATH</literal>\r
153                                                 <literal>CWD</literal>\r
154                                         </para>\r
155                                 </listitem>\r
156                         </varlistentry>\r
157                         <varlistentry>\r
158                                 <term>Pre-update</term>\r
159                                 <listitem condition="pot">\r
160                                         <para>\r
161                                                 <literal>PATH</literal>\r
162                                                 <literal>DEPTH</literal>\r
163                                                 <literal>REVISION</literal>\r
164                                                 <literal>CWD</literal>\r
165                                         </para>\r
166                                 </listitem>\r
167                         </varlistentry>\r
168                         <varlistentry>\r
169                                 <term>Post-update</term>\r
170                                 <listitem condition="pot">\r
171                                         <para>\r
172                                                 <literal>PATH</literal>\r
173                                                 <literal>DEPTH</literal>\r
174                                                 <literal>REVISION</literal>\r
175                                                 <literal>ERROR</literal>\r
176                                                 <literal>CWD</literal>\r
177                                         </para>\r
178                                 </listitem>\r
179                         </varlistentry>\r
180                 </variablelist>\r
181         </para>\r
182         <para>\r
183                 The meaning of each of these parameters is described here:\r
184                 <variablelist>\r
185                         <varlistentry>\r
186                                 <term condition="pot">PATH</term>\r
187                                 <listitem>\r
188                                         <para>\r
189                                                 A path to a temporary file which contains all the\r
190                                                 paths for which the operation was started.\r
191                                                 Each path is on a separate line in the temp file.\r
192                                         </para>\r
193                                 </listitem>\r
194                         </varlistentry>\r
195                         <varlistentry>\r
196                                 <term condition="pot">DEPTH</term>\r
197                                 <listitem>\r
198                                         <para>\r
199                                                 The depth with which the commit/update is done.\r
200                                         </para>\r
201                                         <para>\r
202                                         Possible values are:\r
203                                         <variablelist>\r
204                                                 <varlistentry>\r
205                                                         <term condition="pot">-2</term>\r
206                                                         <listitem>\r
207                                                                 <para>\r
208                                                                         <literal>svn_depth_unknown</literal>\r
209                                                                 </para>\r
210                                                         </listitem>\r
211                                                 </varlistentry>\r
212                                                 <varlistentry>\r
213                                                         <term condition="pot">-1</term>\r
214                                                         <listitem>\r
215                                                                 <para>\r
216                                                                         <literal>svn_depth_exclude</literal>\r
217                                                                 </para>\r
218                                                         </listitem>\r
219                                                 </varlistentry>\r
220                                                 <varlistentry>\r
221                                                         <term condition="pot">0</term>\r
222                                                         <listitem>\r
223                                                                 <para>\r
224                                                                         <literal>svn_depth_empty</literal>\r
225                                                                 </para>\r
226                                                         </listitem>\r
227                                                 </varlistentry>\r
228                                                 <varlistentry>\r
229                                                         <term condition="pot">1</term>\r
230                                                         <listitem>\r
231                                                                 <para>\r
232                                                                         <literal>svn_depth_files</literal>\r
233                                                                 </para>\r
234                                                         </listitem>\r
235                                                 </varlistentry>\r
236                                                 <varlistentry>\r
237                                                         <term condition="pot">2</term>\r
238                                                         <listitem>\r
239                                                                 <para>\r
240                                                                         <literal>svn_depth_immediates</literal>\r
241                                                                 </para>\r
242                                                         </listitem>\r
243                                                 </varlistentry>\r
244                                                 <varlistentry>\r
245                                                         <term condition="pot">3</term>\r
246                                                         <listitem>\r
247                                                                 <para>\r
248                                                                         <literal>svn_depth_infinity</literal>\r
249                                                                 </para>\r
250                                                         </listitem>\r
251                                                 </varlistentry>\r
252                                         </variablelist>\r
253                                         </para>\r
254                                 </listitem>\r
255                         </varlistentry>\r
256                         <varlistentry>\r
257                                 <term condition="pot">MESSAGEFILE</term>\r
258                                 <listitem>\r
259                                         <para>\r
260                                                 Path to a file containing the log message for\r
261                                                 the commit. The file contains the text in UTF-8\r
262                                                 encoding. After successful execution of the\r
263                                                 start-commit hook, the log message is read back,\r
264                                                 giving the hook a chance to modify it.\r
265                                         </para>\r
266                                 </listitem>\r
267                         </varlistentry>\r
268                         <varlistentry>\r
269                                 <term condition="pot">REVISION</term>\r
270                                 <listitem>\r
271                                         <para>\r
272                                                 The repository revision to which the update should\r
273                                                 be done or after a commit completes.\r
274                                         </para>\r
275                                 </listitem>\r
276                         </varlistentry>\r
277                         <varlistentry>\r
278                                 <term condition="pot">ERROR</term>\r
279                                 <listitem>\r
280                                         <para>\r
281                                                 Path to a file containing the error message.\r
282                                                 If there was no error, the file will be empty.\r
283                                         </para>\r
284                                 </listitem>\r
285                         </varlistentry>\r
286                         <varlistentry>\r
287                                 <term condition="pot">CWD</term>\r
288                                 <listitem>\r
289                                         <para>\r
290                                                 The current working directory with which the script is run.\r
291                                                 This is set to the common root directory of all affected paths.\r
292                                         </para>\r
293                                 </listitem>\r
294                         </varlistentry>\r
295                 </variablelist>\r
296         </para>\r
297         <para>\r
298                 Note that although we have given these parameters names for convenience,\r
299                 you do not have to refer to those names in the hook settings.\r
300                 All parameters listed for a particular hook are always passed,\r
301                 whether you want them or not ;-)\r
302         </para>\r
303         <para>\r
304                 If you want the Git operation to hold off until the hook has completed,\r
305                 check <guilabel>Wait for the script to finish</guilabel>.\r
306         </para>\r
307         <para>\r
308                 Normally you will want to hide ugly DOS boxes when the script runs,\r
309                 so <guilabel>Hide the script while running</guilabel> is checked by default.\r
310         </para>\r
311         <para>\r
312                 Sample client hook scripts can be found in the <literal>contrib</literal> folder in the\r
313                 <ulink url="http://TortoiseGit.tigris.org/svn/TortoiseGit/trunk/contrib/hook-scripts">\r
314                         <citetitle>TortoiseGit repository</citetitle>\r
315                 </ulink>.\r
316                 (<xref linkend="tsvn-preface-source"/> explains how to access the repository).\r
317         </para>\r
318         -->\r
319         <sect3 id="tsvn-dug-settings-hooks-issuetracker">\r
320                 <title>Issue Tracker Integration</title>\r
321                 <?dbhh topicname="HIDD_SETTINGSBUGTRAQ"?>\r
322                 <?dbhh topicname="HIDD_SETTINGSBUGTRAQADV"?>\r
323                 <para>\r
324                         TortoiseGit can use a COM plugin to query issue trackers when in the\r
325                         commit dialog. The use of such plugins is described in\r
326                         <xref linkend="tsvn-dug-bugtracker-ref" />.\r
327                         If your system administrator has provided you with a plugin, which\r
328                         you have already installed and registered, this is the place to\r
329                         specify how it integrates with your working tree.\r
330                 </para>\r
331                 <para>\r
332                         <figure id="tsvn-dug-settings-dia-issuetracker">\r
333                                 <title>The Settings Dialog, Issue Tracker Integration Page</title>\r
334                                 <graphic fileref="../images/SettingsIssueTracker.png"/>\r
335                         </figure>\r
336                         Click on <guibutton>Add...</guibutton> to use the plugin with\r
337                         a particular working tree. Here you can specify the working tree\r
338                         path, choose which plugin to use from a drop down list of all\r
339                         registered issue tracker plugins, and any parameters to pass.\r
340                         The parameters will be specific to the plugin, but might include\r
341                         your user name on the issue tracker so that the plugin can\r
342                         query for issues which are assigned to you.\r
343                 </para>\r
344         </sect3>\r
345         <sect3 id="tsvn-dug-settings-hooks-issuetracker-config">\r
346         <title>Config</title>\r
347                 <para>\r
348                         <figure id="tsvn-dug-settings-hooks-issuetrack-config">\r
349                                 <title>The Settings Dialog, issue track config</title>\r
350                                 <graphic fileref="../images/SettingsIssueTrackerConfig.png"/>\r
351                         </figure>\r
352                 </para>\r
353         </sect3>\r
354 </sect2>\r