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

Example Use-Case

Lets say developers put bug ids in their commit messages. Wouldnt it be useful to have the bug ids show up as links to the bug page for that bug id on the web UI? For example look at the descriptions of the commit messages on the following page:

http://sonichg.zspin.com/hgview.cgi/calc/shortlog

You can see the 7 digit numbers are links to a make-believe bug webpage. The regex filter allows you to specify the in HGRC file what regex expression to look for in the commit descriptions, and what to replace it with. In the example below, I am looking for all 7 digit numbers (and only 7 digits, the regex will not match 8 digit numbers) and replacing it with a URL, which includes the 7 digit number. Note that I am using a style for the link called "pla" - feel free to use that style.

Configure HGRC to Use Regex Filter

In order to use regex filter over the web interface, you must use the gitweb_sonic template. First create a folder called sonichgv2m102 in the htdocs folder (assuming you have apache running). Copy over the files in the sonichgv2m102/static folder to this newly created directory. Then modify the HGRC file of the repo to include:

 [extensions]
 sonic=/export/hgstuff/sonichgv2m102/hgext/sonic.py
 sonicweb=/export/hgstuff/sonichgv2m102/hgext/sonicweb.py
 [web]
 templates=/export/hgstuff/sonichgv2m102/templates
 style=gitweb_sonic
 staticurl=http://yourserver.com/sonichgv2m102
 encoding=UTF-8
 [sonichg]
 regexfilter=(?:^(\d{7})$)|(?:^(\d{7})(?=[^\d]))|(?:[^\d](\d{7})(?=[^\d]))|(?:[^\d](\d{7})$)
 filterval=<a class=pla href=http://yourbugdb.com/showticket?bug=REGEXFILTER>REGEXFILTER</a>

Regex Filter in Action

Go to the following shortlog page:

http://sonichg.zspin.com/hgview.cgi/calc/shortlog

You will see the bug ids (7 digit numbers) are links to a make-believe bug webpage.



  • 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