hgbook

view it/examples/hook.simple.pretxncommit.it @ 797:26b05b7dd445

Minor changes and translation of code snippets for Ch.10.
author Giulio@puck
date Thu Aug 13 18:57:50 2009 +0200 (2009-08-13)
parents
children 5bbebcdfb533
line source
1 <!-- BEGIN hook.simple.pretxncommit -->
2 <screen><prompt>$</prompt> <userinput>cat controlla_bug_id</userinput>
3 #!/bin/sh
4 # controlla che un messaggio di commit contenga un identificatore numerico di bug
5 hg log -r $1 --template {desc} | grep -q "\&lt;bug *[0-9]"
6 <prompt>$</prompt> <userinput>echo 'pretxncommit.bug_id_richiesto = ./controlla_bug_id $HG_NODE' &gt;&gt; .hg/hgrc</userinput>
7 <prompt>$</prompt> <userinput>echo a &gt;&gt; a</userinput>
8 <prompt>$</prompt> <userinput>hg commit -m 'Non ho menzionato alcun identificatore di bug.'</userinput>
9 transazione abortita!
10 ripristino completato
11 fallimento: l'hook pretxncommit.bug_id_richiesto รจ terminato con codice di stato 1
12 <prompt>$</prompt> <userinput>hg commit -m 'Vi rimando al bug 666.'</userinput>
13 inserito f753cb1e1e77ea944429e1a84d8728e96b41446e
14 data di inserimento: Fri Jun 5 15:50:29 GMT 2009
15 </screen>
16 <!-- END hook.simple.pretxncommit -->