hgbook
view it/examples/hook.simple.pretxncommit.it @ 812:42e2c9d47ef4
Minor changes and translation of code snippets for Ch.12.
author | Giulio@puck |
---|---|
date | Sat Aug 15 15:15:39 2009 +0200 (2009-08-15) |
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 "\<bug *[0-9]"
6 <prompt>$</prompt> <userinput>echo 'pretxncommit.bug_id_richiesto = ./controlla_bug_id $HG_NODE' >> .hg/hgrc</userinput>
7 <prompt>$</prompt> <userinput>echo a >> 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 -->