Question

I need to run a CVS pre-commit script on any javascript files being committed. The script basically runs JS Hint to confirm any javascript code is in good shape. The problem is that I cannot install JS Hint on the same machine I have my CVS repository. The easiest solution I came up with is for the pre-commit script to ssh the JS Hint command on another machine with JS Hint installed. My issue is that I'm not sure how to get the new contents of the file over to the remote machine since it is not yet committed to CVS. Does the CVS machine even have a way to access the new contents from within the pre-commit script?

Was it helpful?

Solution

Commitinfo provides regular expression arguments that if matched would run your command on those files, according to this:

http://durak.org/sean/pubs/software/cvsbook/The-commitinfo-And-loginfo-And-rcsinfo-Files.html

Commitinfo

The commitinfo' file defines programs to execute whenevercvs commit' is about to execute. These programs are used for pre-commit checking to verify that the modified, added and removed files are really ready to be committed. This could be used, for instance, to verify that the changed files conform to to your site's standards for coding practice.

As mentioned earlier, each line in the `commitinfo' file consists of a regular expression and a command-line template. The template can include a program name and any number of arguments you wish to supply to it. The full path to the current source repository is appended to the template, followed by the file names of any files involved in the commit (added, removed, and modified files).

The first line with a regular expression matching the relative path to the module will be used. If the command returns a non-zero exit status the commit will be aborted.

If the repository name does not match any of the regular expressions in this file, the `DEFAULT' line is used, if it is specified.

All occurances of the name ALL' appearing as a regular expression are used in addition to the first matching regular expression or the nameDEFAULT'.

Note: when CVS is accessing a remote repository, `commitinfo' will be run on the remote (i.e., server) side, not the client side (see section Remote repositories).

From: http://herbert.the-little-red-haired-girl.org/html/cvs/cvs_18.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top