Mercurial > hgbook
comparison en/ch09-hook.xml @ 809:ef53d025f410
Mention qdelete and qimport -r.
| author | Bryan O'Sullivan <bos@serpentine.com> |
|---|---|
| date | Thu, 23 Apr 2009 22:24:02 -0700 |
| parents | b338f5490029 |
| children | 88828b784971 |
comparison
equal
deleted
inserted
replaced
| 808:557552d4699f | 809:ef53d025f410 |
|---|---|
| 145 you do not own (e.g. using <command role="hg-cmd">hg | 145 you do not own (e.g. using <command role="hg-cmd">hg |
| 146 pull</command> or <command role="hg-cmd">hg | 146 pull</command> or <command role="hg-cmd">hg |
| 147 incoming</command>), remember that it is the other | 147 incoming</command>), remember that it is the other |
| 148 repository's hooks you should be checking, not your own. | 148 repository's hooks you should be checking, not your own. |
| 149 </para> | 149 </para> |
| 150 | 150 </sect2> |
| 151 </sect2> | 151 |
| 152 <sect2> | 152 <sect2> |
| 153 <title>Hooks do not propagate</title> | 153 <title>Hooks do not propagate</title> |
| 154 | 154 |
| 155 <para id="x_1fc">In Mercurial, hooks are not revision controlled, and do | 155 <para id="x_1fc">In Mercurial, hooks are not revision controlled, and do |
| 156 not propagate when you clone, or pull from, a repository. The | 156 not propagate when you clone, or pull from, a repository. The |
| 176 control, as you can for example provide a | 176 control, as you can for example provide a |
| 177 <quote>standard</quote> installation of Mercurial on an NFS | 177 <quote>standard</quote> installation of Mercurial on an NFS |
| 178 filesystem, and use a site-wide <filename role="special">~/.hgrc</filename> file to define hooks that all users will | 178 filesystem, and use a site-wide <filename role="special">~/.hgrc</filename> file to define hooks that all users will |
| 179 see. However, this too has its limits; see below. | 179 see. However, this too has its limits; see below. |
| 180 </para> | 180 </para> |
| 181 | 181 </sect2> |
| 182 </sect2> | 182 |
| 183 <sect2> | 183 <sect2> |
| 184 <title>Hooks can be overridden</title> | 184 <title>Hooks can be overridden</title> |
| 185 | 185 |
| 186 <para id="x_200">Mercurial allows you to override a hook definition by | 186 <para id="x_200">Mercurial allows you to override a hook definition by |
| 187 redefining the hook. You can disable it by setting its value | 187 redefining the hook. You can disable it by setting its value |
| 191 <para id="x_201">If you deploy a system- or site-wide <filename | 191 <para id="x_201">If you deploy a system- or site-wide <filename |
| 192 role="special">~/.hgrc</filename> file that defines some | 192 role="special">~/.hgrc</filename> file that defines some |
| 193 hooks, you should thus understand that your users can disable | 193 hooks, you should thus understand that your users can disable |
| 194 or override those hooks. | 194 or override those hooks. |
| 195 </para> | 195 </para> |
| 196 | 196 </sect2> |
| 197 </sect2> | 197 |
| 198 <sect2> | 198 <sect2> |
| 199 <title>Ensuring that critical hooks are run</title> | 199 <title>Ensuring that critical hooks are run</title> |
| 200 | 200 |
| 201 <para id="x_202">Sometimes you may want to enforce a policy that you do not | 201 <para id="x_202">Sometimes you may want to enforce a policy that you do not |
| 202 want others to be able to work around. For example, you may | 202 want others to be able to work around. For example, you may |
| 230 that people pull have been automatically vetted. | 230 that people pull have been automatically vetted. |
| 231 </para> | 231 </para> |
| 232 | 232 |
| 233 </sect2> | 233 </sect2> |
| 234 </sect1> | 234 </sect1> |
| 235 <sect1> | 235 |
| 236 <title>Care with <literal>pretxn</literal> hooks in a | |
| 237 shared-access repository</title> | |
| 238 | |
| 239 <para id="x_206">If you want to use hooks to do some automated work in a | |
| 240 repository that a number of people have shared access to, you | |
| 241 need to be careful in how you do this. | |
| 242 </para> | |
| 243 | |
| 244 <para id="x_207">Mercurial only locks a repository when it is writing to the | |
| 245 repository, and only the parts of Mercurial that write to the | |
| 246 repository pay attention to locks. Write locks are necessary to | |
| 247 prevent multiple simultaneous writers from scribbling on each | |
| 248 other's work, corrupting the repository. | |
| 249 </para> | |
| 250 | |
| 251 <para id="x_208">Because Mercurial is careful with the order in which it | |
| 252 reads and writes data, it does not need to acquire a lock when | |
| 253 it wants to read data from the repository. The parts of | |
| 254 Mercurial that read from the repository never pay attention to | |
| 255 locks. This lockless reading scheme greatly increases | |
| 256 performance and concurrency. | |
| 257 </para> | |
| 258 | |
| 259 <para id="x_209">With great performance comes a trade-off, though, one which | |
| 260 has the potential to cause you trouble unless you're aware of | |
| 261 it. To describe this requires a little detail about how | |
| 262 Mercurial adds changesets to a repository and reads those | |
| 263 changes. | |
| 264 </para> | |
| 265 | |
| 266 <para id="x_20a">When Mercurial <emphasis>writes</emphasis> metadata, it | |
| 267 writes it straight into the destination file. It writes file | |
| 268 data first, then manifest data (which contains pointers to the | |
| 269 new file data), then changelog data (which contains pointers to | |
| 270 the new manifest data). Before the first write to each file, it | |
| 271 stores a record of where the end of the file was in its | |
| 272 transaction log. If the transaction must be rolled back, | |
| 273 Mercurial simply truncates each file back to the size it was | |
| 274 before the transaction began. | |
| 275 </para> | |
| 276 | |
| 277 <para id="x_20b">When Mercurial <emphasis>reads</emphasis> metadata, it reads | |
| 278 the changelog first, then everything else. Since a reader will | |
| 279 only access parts of the manifest or file metadata that it can | |
| 280 see in the changelog, it can never see partially written data. | |
| 281 </para> | |
| 282 | |
| 283 <para id="x_20c">Some controlling hooks (<literal | |
| 284 role="hook">pretxncommit</literal> and <literal | |
| 285 role="hook">pretxnchangegroup</literal>) run when a | |
| 286 transaction is almost complete. All of the metadata has been | |
| 287 written, but Mercurial can still roll the transaction back and | |
| 288 cause the newly-written data to disappear. | |
| 289 </para> | |
| 290 | |
| 291 <para id="x_20d">If one of these hooks runs for long, it opens a window of | |
| 292 time during which a reader can see the metadata for changesets | |
| 293 that are not yet permanent, and should not be thought of as | |
| 294 <quote>really there</quote>. The longer the hook runs, the | |
| 295 longer that window is open. | |
| 296 </para> | |
| 297 | |
| 298 <sect2> | |
| 299 <title>The problem illustrated</title> | |
| 300 | |
| 301 <para id="x_20e">In principle, a good use for the <literal | |
| 302 role="hook">pretxnchangegroup</literal> hook would be to | |
| 303 automatically build and test incoming changes before they are | |
| 304 accepted into a central repository. This could let you | |
| 305 guarantee that nobody can push changes to this repository that | |
| 306 <quote>break the build</quote>. But if a client can pull | |
| 307 changes while they're being tested, the usefulness of the test | |
| 308 is zero; an unsuspecting someone can pull untested changes, | |
| 309 potentially breaking their build. | |
| 310 </para> | |
| 311 | |
| 312 <para id="x_20f">The safest technological answer to this challenge is to | |
| 313 set up such a <quote>gatekeeper</quote> repository as | |
| 314 <emphasis>unidirectional</emphasis>. Let it take changes | |
| 315 pushed in from the outside, but do not allow anyone to pull | |
| 316 changes from it (use the <literal | |
| 317 role="hook">preoutgoing</literal> hook to lock it down). | |
| 318 Configure a <literal role="hook">changegroup</literal> hook so | |
| 319 that if a build or test succeeds, the hook will push the new | |
| 320 changes out to another repository that people | |
| 321 <emphasis>can</emphasis> pull from. | |
| 322 </para> | |
| 323 | |
| 324 <para id="x_210">In practice, putting a centralised bottleneck like this in | |
| 325 place is not often a good idea, and transaction visibility has | |
| 326 nothing to do with the problem. As the size of a | |
| 327 project&emdash;and the time it takes to build and | |
| 328 test&emdash;grows, you rapidly run into a wall with this | |
| 329 <quote>try before you buy</quote> approach, where you have | |
| 330 more changesets to test than time in which to deal with them. | |
| 331 The inevitable result is frustration on the part of all | |
| 332 involved. | |
| 333 </para> | |
| 334 | |
| 335 <para id="x_211">An approach that scales better is to get people to build | |
| 336 and test before they push, then run automated builds and tests | |
| 337 centrally <emphasis>after</emphasis> a push, to be sure all is | |
| 338 well. The advantage of this approach is that it does not | |
| 339 impose a limit on the rate at which the repository can accept | |
| 340 changes. | |
| 341 </para> | |
| 342 | |
| 343 </sect2> | |
| 344 </sect1> | |
| 345 <sect1 id="sec:hook:simple"> | 236 <sect1 id="sec:hook:simple"> |
| 346 <title>A short tutorial on using hooks</title> | 237 <title>A short tutorial on using hooks</title> |
| 347 | 238 |
| 348 <para id="x_212">It is easy to write a Mercurial hook. Let's start with a | 239 <para id="x_212">It is easy to write a Mercurial hook. Let's start with a |
| 349 hook that runs when you finish a <command role="hg-cmd">hg | 240 hook that runs when you finish a <command role="hg-cmd">hg |
| 507 parameter is named <literal>foo</literal>, the keyword | 398 parameter is named <literal>foo</literal>, the keyword |
| 508 argument for a Python hook will also be named | 399 argument for a Python hook will also be named |
| 509 <literal>foo</literal>, while the environment variable for an | 400 <literal>foo</literal>, while the environment variable for an |
| 510 external hook will be named <literal>HG_FOO</literal>. | 401 external hook will be named <literal>HG_FOO</literal>. |
| 511 </para> | 402 </para> |
| 512 | 403 </sect2> |
| 513 </sect2> | 404 |
| 514 <sect2> | 405 <sect2> |
| 515 <title>Hook return values and activity control</title> | 406 <title>Hook return values and activity control</title> |
| 516 | 407 |
| 517 <para id="x_225">A hook that executes successfully must exit with a status | 408 <para id="x_225">A hook that executes successfully must exit with a status |
| 518 of zero if external, or return boolean <quote>false</quote> if | 409 of zero if external, or return boolean <quote>false</quote> if |
| 524 | 415 |
| 525 <para id="x_226">For a hook that controls whether an activity can proceed, | 416 <para id="x_226">For a hook that controls whether an activity can proceed, |
| 526 zero/false means <quote>allow</quote>, while | 417 zero/false means <quote>allow</quote>, while |
| 527 non-zero/true/exception means <quote>deny</quote>. | 418 non-zero/true/exception means <quote>deny</quote>. |
| 528 </para> | 419 </para> |
| 529 | 420 </sect2> |
| 530 </sect2> | 421 |
| 531 <sect2> | 422 <sect2> |
| 532 <title>Writing an external hook</title> | 423 <title>Writing an external hook</title> |
| 533 | 424 |
| 534 <para id="x_227">When you define an external hook in your <filename | 425 <para id="x_227">When you define an external hook in your <filename |
| 535 role="special">~/.hgrc</filename> and the hook is run, its | 426 role="special">~/.hgrc</filename> and the hook is run, its |
| 553 that may be run by a number of different users with differing | 444 that may be run by a number of different users with differing |
| 554 environment variables set. In multi-user situations, you | 445 environment variables set. In multi-user situations, you |
| 555 should not rely on environment variables being set to the | 446 should not rely on environment variables being set to the |
| 556 values you have in your environment when testing the hook. | 447 values you have in your environment when testing the hook. |
| 557 </para> | 448 </para> |
| 558 | 449 </sect2> |
| 559 </sect2> | 450 |
| 560 <sect2> | 451 <sect2> |
| 561 <title>Telling Mercurial to use an in-process hook</title> | 452 <title>Telling Mercurial to use an in-process hook</title> |
| 562 | 453 |
| 563 <para id="x_22b">The <filename role="special">~/.hgrc</filename> syntax | 454 <para id="x_22b">The <filename role="special">~/.hgrc</filename> syntax |
| 564 for defining an in-process hook is slightly different than for | 455 for defining an in-process hook is slightly different than for |
| 583 <para id="x_22e">When Mercurial runs the <literal>commit.example</literal> | 474 <para id="x_22e">When Mercurial runs the <literal>commit.example</literal> |
| 584 hook, it imports <literal>mymodule.submodule</literal>, looks | 475 hook, it imports <literal>mymodule.submodule</literal>, looks |
| 585 for the callable object named <literal>myhook</literal>, and | 476 for the callable object named <literal>myhook</literal>, and |
| 586 calls it. | 477 calls it. |
| 587 </para> | 478 </para> |
| 588 | 479 </sect2> |
| 589 </sect2> | 480 |
| 590 <sect2> | 481 <sect2> |
| 591 <title>Writing an in-process hook</title> | 482 <title>Writing an in-process hook</title> |
| 592 | 483 |
| 593 <para id="x_22f">The simplest in-process hook does nothing, but illustrates | 484 <para id="x_22f">The simplest in-process hook does nothing, but illustrates |
| 594 the basic shape of the hook API: | 485 the basic shape of the hook API: |
| 620 hook of the example below will prevent you from committing a | 511 hook of the example below will prevent you from committing a |
| 621 changeset with a message that is less than ten bytes long. | 512 changeset with a message that is less than ten bytes long. |
| 622 </para> | 513 </para> |
| 623 | 514 |
| 624 &interaction.hook.msglen.go; | 515 &interaction.hook.msglen.go; |
| 625 | 516 </sect2> |
| 626 </sect2> | 517 |
| 627 <sect2> | 518 <sect2> |
| 628 <title>Checking for trailing whitespace</title> | 519 <title>Checking for trailing whitespace</title> |
| 629 | 520 |
| 630 <para id="x_232">An interesting use of a commit-related hook is to help you | 521 <para id="x_232">An interesting use of a commit-related hook is to help you |
| 631 to write cleaner code. A simple example of <quote>cleaner | 522 to write cleaner code. A simple example of <quote>cleaner |
| 836 role="hg-ext">acl</literal> hook will print enough | 727 role="hg-ext">acl</literal> hook will print enough |
| 837 information to let you figure out why it is allowing or | 728 information to let you figure out why it is allowing or |
| 838 forbidding pushes from specific users. | 729 forbidding pushes from specific users. |
| 839 </para> | 730 </para> |
| 840 | 731 |
| 841 </sect3> | 732 </sect3> </sect2> |
| 842 </sect2> | 733 |
| 843 <sect2> | 734 <sect2> |
| 844 <title><literal | 735 <title><literal |
| 845 role="hg-ext">bugzilla</literal>&emdash;integration with | 736 role="hg-ext">bugzilla</literal>&emdash;integration with |
| 846 Bugzilla</title> | 737 Bugzilla</title> |
| 847 | 738 |
| 1142 Bugzilla user name, nor does it have an entry in your | 1033 Bugzilla user name, nor does it have an entry in your |
| 1143 <literal role="rc-usermap">usermap</literal> that maps it to | 1034 <literal role="rc-usermap">usermap</literal> that maps it to |
| 1144 a valid Bugzilla user name. | 1035 a valid Bugzilla user name. |
| 1145 </para> | 1036 </para> |
| 1146 | 1037 |
| 1147 </sect3> | 1038 </sect3> </sect2> |
| 1148 </sect2> | 1039 |
| 1149 <sect2> | 1040 <sect2> |
| 1150 <title><literal role="hg-ext">notify</literal>&emdash;send email | 1041 <title><literal role="hg-ext">notify</literal>&emdash;send email |
| 1151 notifications</title> | 1042 notifications</title> |
| 1152 | 1043 |
| 1153 <para id="x_26a">Although Mercurial's built-in web server provides RSS | 1044 <para id="x_26a">Although Mercurial's built-in web server provides RSS |
| 1342 <para id="x_280">Note that changeset IDs are passed into Python hooks as | 1233 <para id="x_280">Note that changeset IDs are passed into Python hooks as |
| 1343 hexadecimal strings, not the binary hashes that Mercurial's | 1234 hexadecimal strings, not the binary hashes that Mercurial's |
| 1344 APIs normally use. To convert a hash from hex to binary, use | 1235 APIs normally use. To convert a hash from hex to binary, use |
| 1345 the <literal>bin</literal> function. | 1236 the <literal>bin</literal> function. |
| 1346 </para> | 1237 </para> |
| 1347 | 1238 </sect2> |
| 1348 </sect2> | 1239 |
| 1349 <sect2> | 1240 <sect2> |
| 1350 <title>External hook execution</title> | 1241 <title>External hook execution</title> |
| 1351 | 1242 |
| 1352 <para id="x_281">An external hook is passed to the shell of the user | 1243 <para id="x_281">An external hook is passed to the shell of the user |
| 1353 running Mercurial. Features of that shell, such as variable | 1244 running Mercurial. Features of that shell, such as variable |
| 1380 | 1271 |
| 1381 <para id="x_284">If a hook exits with a status of zero, it is considered to | 1272 <para id="x_284">If a hook exits with a status of zero, it is considered to |
| 1382 have succeeded. If it exits with a non-zero status, it is | 1273 have succeeded. If it exits with a non-zero status, it is |
| 1383 considered to have failed. | 1274 considered to have failed. |
| 1384 </para> | 1275 </para> |
| 1385 | 1276 </sect2> |
| 1386 </sect2> | 1277 |
| 1387 <sect2> | 1278 <sect2> |
| 1388 <title>Finding out where changesets come from</title> | 1279 <title>Finding out where changesets come from</title> |
| 1389 | 1280 |
| 1390 <para id="x_285">A hook that involves the transfer of changesets between a | 1281 <para id="x_285">A hook that involves the transfer of changesets between a |
| 1391 local repository and another may be able to find out | 1282 local repository and another may be able to find out |
| 1423 </listitem> | 1314 </listitem> |
| 1424 <listitem><para id="x_28a"><literal>bundle</literal>: Changesets are | 1315 <listitem><para id="x_28a"><literal>bundle</literal>: Changesets are |
| 1425 being transferred to or from a bundle. | 1316 being transferred to or from a bundle. |
| 1426 </para> | 1317 </para> |
| 1427 </listitem></itemizedlist> | 1318 </listitem></itemizedlist> |
| 1428 | |
| 1429 </sect3> | 1319 </sect3> |
| 1320 | |
| 1430 <sect3 id="sec:hook:url"> | 1321 <sect3 id="sec:hook:url"> |
| 1431 <title>Where changes are going&emdash;remote repository | 1322 <title>Where changes are going&emdash;remote repository |
| 1432 URLs</title> | 1323 URLs</title> |
| 1433 | 1324 |
| 1434 <para id="x_28b">When possible, Mercurial will tell a hook the location | 1325 <para id="x_28b">When possible, Mercurial will tell a hook the location |
| 1460 </listitem> | 1351 </listitem> |
| 1461 <listitem><para id="x_28f">Empty&emdash;no information could be | 1352 <listitem><para id="x_28f">Empty&emdash;no information could be |
| 1462 discovered about the remote client. | 1353 discovered about the remote client. |
| 1463 </para> | 1354 </para> |
| 1464 </listitem></itemizedlist> | 1355 </listitem></itemizedlist> |
| 1465 | |
| 1466 </sect3> | 1356 </sect3> |
| 1467 </sect2> | 1357 </sect2> |
| 1468 </sect1> | 1358 </sect1> |
| 1469 <sect1> | 1359 <sect1> |
| 1470 <title>Hook reference</title> | 1360 <title>Hook reference</title> |
| 1518 role="hook">prechangegroup</literal> (<xref | 1408 role="hook">prechangegroup</literal> (<xref |
| 1519 linkend="sec:hook:prechangegroup"/>), <literal | 1409 linkend="sec:hook:prechangegroup"/>), <literal |
| 1520 role="hook">pretxnchangegroup</literal> (<xref | 1410 role="hook">pretxnchangegroup</literal> (<xref |
| 1521 linkend="sec:hook:pretxnchangegroup"/>) | 1411 linkend="sec:hook:pretxnchangegroup"/>) |
| 1522 </para> | 1412 </para> |
| 1523 | 1413 </sect2> |
| 1524 </sect2> | 1414 |
| 1525 <sect2 id="sec:hook:commit"> | 1415 <sect2 id="sec:hook:commit"> |
| 1526 <title><literal role="hook">commit</literal>&emdash;after a new | 1416 <title><literal role="hook">commit</literal>&emdash;after a new |
| 1527 changeset is created</title> | 1417 changeset is created</title> |
| 1528 | 1418 |
| 1529 <para id="x_297">This hook is run after a new changeset has been created. | 1419 <para id="x_297">This hook is run after a new changeset has been created. |
| 1551 role="hook">precommit</literal> (<xref | 1441 role="hook">precommit</literal> (<xref |
| 1552 linkend="sec:hook:precommit"/>), <literal | 1442 linkend="sec:hook:precommit"/>), <literal |
| 1553 role="hook">pretxncommit</literal> (<xref | 1443 role="hook">pretxncommit</literal> (<xref |
| 1554 linkend="sec:hook:pretxncommit"/>) | 1444 linkend="sec:hook:pretxncommit"/>) |
| 1555 </para> | 1445 </para> |
| 1556 | 1446 </sect2> |
| 1557 </sect2> | 1447 |
| 1558 <sect2 id="sec:hook:incoming"> | 1448 <sect2 id="sec:hook:incoming"> |
| 1559 <title><literal role="hook">incoming</literal>&emdash;after one | 1449 <title><literal role="hook">incoming</literal>&emdash;after one |
| 1560 remote changeset is added</title> | 1450 remote changeset is added</title> |
| 1561 | 1451 |
| 1562 <para id="x_29d">This hook is run after a pre-existing changeset has been | 1452 <para id="x_29d">This hook is run after a pre-existing changeset has been |
| 1597 role="hook">prechangegroup</literal> (<xref | 1487 role="hook">prechangegroup</literal> (<xref |
| 1598 linkend="sec:hook:prechangegroup"/>), <literal | 1488 linkend="sec:hook:prechangegroup"/>), <literal |
| 1599 role="hook">pretxnchangegroup</literal> (<xref | 1489 role="hook">pretxnchangegroup</literal> (<xref |
| 1600 linkend="sec:hook:pretxnchangegroup"/>) | 1490 linkend="sec:hook:pretxnchangegroup"/>) |
| 1601 </para> | 1491 </para> |
| 1602 | 1492 </sect2> |
| 1603 </sect2> | 1493 |
| 1604 <sect2 id="sec:hook:outgoing"> | 1494 <sect2 id="sec:hook:outgoing"> |
| 1605 <title><literal role="hook">outgoing</literal>&emdash;after | 1495 <title><literal role="hook">outgoing</literal>&emdash;after |
| 1606 changesets are propagated</title> | 1496 changesets are propagated</title> |
| 1607 | 1497 |
| 1608 <para id="x_2a4">This hook is run after a group of changesets has been | 1498 <para id="x_2a4">This hook is run after a group of changesets has been |
| 1644 | 1534 |
| 1645 <para id="x_2aa">See also: <literal | 1535 <para id="x_2aa">See also: <literal |
| 1646 role="hook">preoutgoing</literal> (<xref | 1536 role="hook">preoutgoing</literal> (<xref |
| 1647 linkend="sec:hook:preoutgoing"/>) | 1537 linkend="sec:hook:preoutgoing"/>) |
| 1648 </para> | 1538 </para> |
| 1649 | 1539 </sect2> |
| 1650 </sect2> | 1540 |
| 1651 <sect2 id="sec:hook:prechangegroup"> | 1541 <sect2 id="sec:hook:prechangegroup"> |
| 1652 <title><literal | 1542 <title><literal |
| 1653 role="hook">prechangegroup</literal>&emdash;before starting | 1543 role="hook">prechangegroup</literal>&emdash;before starting |
| 1654 to add remote changesets</title> | 1544 to add remote changesets</title> |
| 1655 | 1545 |
| 1690 role="hook">incoming</literal> (<xref | 1580 role="hook">incoming</literal> (<xref |
| 1691 linkend="sec:hook:incoming"/>), <literal | 1581 linkend="sec:hook:incoming"/>), <literal |
| 1692 role="hook">pretxnchangegroup</literal> (<xref | 1582 role="hook">pretxnchangegroup</literal> (<xref |
| 1693 linkend="sec:hook:pretxnchangegroup"/>) | 1583 linkend="sec:hook:pretxnchangegroup"/>) |
| 1694 </para> | 1584 </para> |
| 1695 | 1585 </sect2> |
| 1696 </sect2> | 1586 |
| 1697 <sect2 id="sec:hook:precommit"> | 1587 <sect2 id="sec:hook:precommit"> |
| 1698 <title><literal role="hook">precommit</literal>&emdash;before | 1588 <title><literal role="hook">precommit</literal>&emdash;before |
| 1699 starting to commit a changeset</title> | 1589 starting to commit a changeset</title> |
| 1700 | 1590 |
| 1701 <para id="x_2b2">This hook is run before Mercurial begins to commit a new | 1591 <para id="x_2b2">This hook is run before Mercurial begins to commit a new |
| 1730 <para id="x_2b8">See also: <literal role="hook">commit</literal> | 1620 <para id="x_2b8">See also: <literal role="hook">commit</literal> |
| 1731 (<xref linkend="sec:hook:commit"/>), <literal | 1621 (<xref linkend="sec:hook:commit"/>), <literal |
| 1732 role="hook">pretxncommit</literal> (<xref | 1622 role="hook">pretxncommit</literal> (<xref |
| 1733 linkend="sec:hook:pretxncommit"/>) | 1623 linkend="sec:hook:pretxncommit"/>) |
| 1734 </para> | 1624 </para> |
| 1735 | 1625 </sect2> |
| 1736 </sect2> | 1626 |
| 1737 <sect2 id="sec:hook:preoutgoing"> | 1627 <sect2 id="sec:hook:preoutgoing"> |
| 1738 <title><literal role="hook">preoutgoing</literal>&emdash;before | 1628 <title><literal role="hook">preoutgoing</literal>&emdash;before |
| 1739 starting to propagate changesets</title> | 1629 starting to propagate changesets</title> |
| 1740 | 1630 |
| 1741 <para id="x_2b9">This hook is invoked before Mercurial knows the identities | 1631 <para id="x_2b9">This hook is invoked before Mercurial knows the identities |
| 1767 | 1657 |
| 1768 <para id="x_2be">See also: <literal | 1658 <para id="x_2be">See also: <literal |
| 1769 role="hook">outgoing</literal> (<xref | 1659 role="hook">outgoing</literal> (<xref |
| 1770 linkend="sec:hook:outgoing"/>) | 1660 linkend="sec:hook:outgoing"/>) |
| 1771 </para> | 1661 </para> |
| 1772 | 1662 </sect2> |
| 1773 </sect2> | 1663 |
| 1774 <sect2 id="sec:hook:pretag"> | 1664 <sect2 id="sec:hook:pretag"> |
| 1775 <title><literal role="hook">pretag</literal>&emdash;before | 1665 <title><literal role="hook">pretag</literal>&emdash;before |
| 1776 tagging a changeset</title> | 1666 tagging a changeset</title> |
| 1777 | 1667 |
| 1778 <para id="x_2bf">This controlling hook is run before a tag is created. If | 1668 <para id="x_2bf">This controlling hook is run before a tag is created. If |
| 1809 | 1699 |
| 1810 <para id="x_2c5">See also: <literal role="hook">tag</literal> | 1700 <para id="x_2c5">See also: <literal role="hook">tag</literal> |
| 1811 (<xref linkend="sec:hook:tag"/>) | 1701 (<xref linkend="sec:hook:tag"/>) |
| 1812 </para> | 1702 </para> |
| 1813 </sect2> | 1703 </sect2> |
| 1704 | |
| 1814 <sect2 id="sec:hook:pretxnchangegroup"> | 1705 <sect2 id="sec:hook:pretxnchangegroup"> |
| 1815 <title><literal | 1706 <title><literal |
| 1816 role="hook">pretxnchangegroup</literal>&emdash;before | 1707 role="hook">pretxnchangegroup</literal>&emdash;before |
| 1817 completing addition of remote changesets</title> | 1708 completing addition of remote changesets</title> |
| 1818 | 1709 |
| 1873 role="hook">incoming</literal> (<xref | 1764 role="hook">incoming</literal> (<xref |
| 1874 linkend="sec:hook:incoming"/>), <literal | 1765 linkend="sec:hook:incoming"/>), <literal |
| 1875 role="hook">prechangegroup</literal> (<xref | 1766 role="hook">prechangegroup</literal> (<xref |
| 1876 linkend="sec:hook:prechangegroup"/>) | 1767 linkend="sec:hook:prechangegroup"/>) |
| 1877 </para> | 1768 </para> |
| 1878 | 1769 </sect2> |
| 1879 </sect2> | 1770 |
| 1880 <sect2 id="sec:hook:pretxncommit"> | 1771 <sect2 id="sec:hook:pretxncommit"> |
| 1881 <title><literal role="hook">pretxncommit</literal>&emdash;before | 1772 <title><literal role="hook">pretxncommit</literal>&emdash;before |
| 1882 completing commit of new changeset</title> | 1773 completing commit of new changeset</title> |
| 1883 | 1774 |
| 1884 <para id="x_2cf">This controlling hook is run before a | 1775 <para id="x_2cf">This controlling hook is run before a |
| 1899 access this repository, they will be able to see the | 1790 access this repository, they will be able to see the |
| 1900 almost-new changeset as if it is permanent. This may lead to | 1791 almost-new changeset as if it is permanent. This may lead to |
| 1901 race conditions if you do not take steps to avoid them. | 1792 race conditions if you do not take steps to avoid them. |
| 1902 </para> | 1793 </para> |
| 1903 | 1794 |
| 1904 <para id="x_2d2">Parameters to this hook: | 1795 <para id="x_2d2">Parameters to this hook:</para> |
| 1905 </para> | 1796 |
| 1906 <itemizedlist> | 1797 <itemizedlist> |
| 1907 <listitem><para id="x_2d3"><literal>node</literal>: A changeset ID. The | 1798 <listitem><para id="x_2d3"><literal>node</literal>: A changeset ID. The |
| 1908 changeset ID of the newly committed changeset. | 1799 changeset ID of the newly committed changeset. |
| 1909 </para> | 1800 </para> |
| 1910 </listitem> | 1801 </listitem> |
| 1921 | 1812 |
| 1922 <para id="x_2d6">See also: <literal | 1813 <para id="x_2d6">See also: <literal |
| 1923 role="hook">precommit</literal> (<xref | 1814 role="hook">precommit</literal> (<xref |
| 1924 linkend="sec:hook:precommit"/>) | 1815 linkend="sec:hook:precommit"/>) |
| 1925 </para> | 1816 </para> |
| 1926 | 1817 </sect2> |
| 1927 </sect2> | 1818 |
| 1928 <sect2 id="sec:hook:preupdate"> | 1819 <sect2 id="sec:hook:preupdate"> |
| 1929 <title><literal role="hook">preupdate</literal>&emdash;before | 1820 <title><literal role="hook">preupdate</literal>&emdash;before |
| 1930 updating or merging working directory</title> | 1821 updating or merging working directory</title> |
| 1931 | 1822 |
| 1932 <para id="x_2d7">This controlling hook is run before an update | 1823 <para id="x_2d7">This controlling hook is run before an update |
| 1953 </para> | 1844 </para> |
| 1954 </listitem></itemizedlist> | 1845 </listitem></itemizedlist> |
| 1955 | 1846 |
| 1956 <para id="x_2db">See also: <literal role="hook">update</literal> | 1847 <para id="x_2db">See also: <literal role="hook">update</literal> |
| 1957 (<xref linkend="sec:hook:update"/>)</para> | 1848 (<xref linkend="sec:hook:update"/>)</para> |
| 1958 | 1849 </sect2> |
| 1959 </sect2> | 1850 |
| 1960 <sect2 id="sec:hook:tag"> | 1851 <sect2 id="sec:hook:tag"> |
| 1961 <title><literal role="hook">tag</literal>&emdash;after tagging a | 1852 <title><literal role="hook">tag</literal>&emdash;after tagging a |
| 1962 changeset</title> | 1853 changeset</title> |
| 1963 | 1854 |
| 1964 <para id="x_2dc">This hook is run after a tag has been created. | 1855 <para id="x_2dc">This hook is run after a tag has been created. |
| 1990 </para> | 1881 </para> |
| 1991 | 1882 |
| 1992 <para id="x_2e2">See also: <literal role="hook">pretag</literal> | 1883 <para id="x_2e2">See also: <literal role="hook">pretag</literal> |
| 1993 (<xref linkend="sec:hook:pretag"/>) | 1884 (<xref linkend="sec:hook:pretag"/>) |
| 1994 </para> | 1885 </para> |
| 1995 | 1886 </sect2> |
| 1996 </sect2> | 1887 |
| 1997 <sect2 id="sec:hook:update"> | 1888 <sect2 id="sec:hook:update"> |
| 1998 <title><literal role="hook">update</literal>&emdash;after | 1889 <title><literal role="hook">update</literal>&emdash;after |
| 1999 updating or merging working directory</title> | 1890 updating or merging working directory</title> |
| 2000 | 1891 |
| 2001 <para id="x_2e3">This hook is run after an update or merge of the working | 1892 <para id="x_2e3">This hook is run after an update or merge of the working |
