Since I have been laid off for the almost two months, I decided to use the time to write a Java program to do pre commit and post commit processing for subversion commits. The program uses a property file to define structured comments and allows mandatory and optional fields. I am in the process of obtaining a copyright and want to make the program available for sale.
I have been looking at the problem of continuous integration triggering builds before the complete set of code has been checked in. I implemented a tag of "OnCommit Run:" to be followed by the command to be run post commit. The post commit processor calls this command with the two arguements the post commit processor received from subversion via the hook. You can write your own batch file or shell script to be run, test it and provide the name in the comment. The processing you want to do is up to you. It can be a call to a database to log information, a call to Smart Bear's Code Collaborator, a file to trigger Cruise Control or any other processing you wish. This allows the development staff to determine when they are finished with a set of functionality. It is meant to help reduce the number of emails that get sent when builds fail during continuous integration. I believe that there is no reason to even try an automated build and test session if the
code is incomplete.
There is one tag that is defined to cause the program to fail so you can use the debugging feature to test your changes to the property file on comments that would pass. That tag is "FAIL:" it puts a failure in the error list causing the program to fail. I found this helpful during the development process. The batch file that the program comes with has a "DEBUG:0" entry on the command line and debug levels of 1 to 4 are defined. A number greater than 4 will cause the maximum debug level, 4, to be used.
The program is written and is being tested using Java 1.6.
The default property file contains:
# The list of required tokens follow the Required property.
#If there are no required tokens defined, there are two possibilities:
# Required present with no values and Required not present.
Required=Checkin Type:
# The Type: will be defined below as a list. If you change the Checkin Type: to something else, you will also have to change the
# left side of the CheckinType.List to match.
# The list of optional tokens follow the Optional property.
# If there are no optional tokens defined, there are two possibilities:
# Optional present with no values and Optional not present.
Optional=Project ID:,QC Bug ID:,Production Bug ID:,Earliest Fix in:,Description:,Cosmetic,Production Bug,Dev Bug,QC Bug,SCR,FAIL:,OnCommit Run:
# Since tokens can contain spaces and ":", the specifications about a token must have the spaces
# and ":" deleted.
# The checkin type is a list, so one of the list members must be present in all commits.
CheckinType.List=Cosmetic,Production Bug,Dev Bug,QC Bug,SCR,Build Mod
#For each list type, optional tags can be overridden and changed to required based on the list name.
Cosmetic.Required=
SCR.Required=Project ID:
ProductionBug.Required=Project ID:,QC Bug ID:,Production Bug ID:,Earliest Fix in:
DevBug.Required=Project ID:,Earliest Fix in:
QCBug.Required=Project ID:,QC Bug ID:,Earliest Fix in:
BuildMod.Required=
# Tokens get a Min_Length of 0 by default. This is overridden using the <token>.Min_Length syntax.
ProjectID.Min_Length=6
EarliestFixin.Min_Length=5
# There are two base types defined, String and Int.
# String is the default, it is overridden using the <token>.Type syntax.
ProjectID.Type=Int
QCBugID.Type=Int
ProductionBugID.Type=Int
# For integers, the minimum value is 0. This is overridden using the <token>.MinValue syntax.
ProjectID.MinValue=200000
# A comment is always required, but in the default properties file the description tag is not.
# The name of the comment label can be changed by modifying the value in the optional list above
# and using the new value following the Comment= below. If you want to make the comment label
# required, move the value from the Optional= line to the Required= line above.
# If the tag associated with a comment is present, it is stripped so the length of the tag is not counted
# as part of the comment.
# If the comment properties are not present, the default
# value of 50 in the Java program for the comment size is used.
Comment=Description:
Comment.Min_Length=30
The default property set up allows for commit templates as follows. The optional comment tag is enclosed in <>.
Checkin Type:Cosmetic
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
Checkin Type:Production Bug
Project ID:
QC Bug ID:
Production Bug ID:
Earliest Fix in:
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
Checkin Type:Dev Bug
Project ID:
Earliest Fix in:
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
Checkin Type:QC Bug
Project ID:
QC Bug ID:
Earliest Fix in:
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
Checkin Type:SCR
Project ID:
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
Checkin Type:Build Mod
<Description:>What ever you want to write
on as many lines as you want to use. All free form text is assumed to be the comment.
If you are interested in obtaining a copy of the program, please send me an email. I am in the process of writing up a manual.
Thank you,
Chuck Holzwarth
(804) 403-3478 (home)
(804) 305-4040 (cell)
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=991597
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2008-12-24 15:05:03 CET