Last updated February 05, 2009 07:07, by hgsonic
Feedicon  

Configure HGRC to Check for Commit Message Syntax

To check for commit message syntax when pushes are made to the repo, modify the HGRC file of the repo as follows:

 [extensions]
 sonic=/export/hgstuff/sonichgv2m102/hgext/sonic.py
 sonicweb=/export/hgstuff/sonichgv2m102/hgext/sonicweb.py
 [hooks]
 changegroup.checkcommitformat=python:sonic.checkcommitformat
 [sonichg]
 commitformat=^([Mm]erge|Bug: \d - .+)
 commitformatdoc=http://yourdevwiki.com/commitformatdoc

The "commitformat" above says that if a commit starts with "merge" where "m" can be capital, or if it starts with "Bug:" followed by a space, followed by 7 digits and then a space and a dash and a space and then anything, it is a valid commit message syntax. So when someone makes a push and the commit message syntax is different they will now see the following warning:

 remote: FORMAT WARNING: commit 148 - Fixed bug 3455433 for version 1.3
 remote: FORMAT WARNING: Please refer to the following docs commit format guidelines:
 remote: FORMAT WARNING:     http://yourdevwiki.com/commitformatdoc

Note: The push will go through just fine, it only gives a warning, it doesnt prevent the push from happening

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2013, Oracle Corporation and/or its affiliates
(revision 20131025.e7cbc9d)
 
 
Close
loading
Please Confirm
Close