[cvsnt] Trigger to enforce certain code via regex, and Audit "diff" field

Gabriel Genellina gagsl-cvsnt at yahoo.com.ar
Mon Nov 3 22:25:29 GMT 2008


En Mon, 03 Nov 2008 19:24:30 -0200, Howard Ha <bluespire at gmail.com>  
escribió:

> Thanks for the prompt reply. By going through that documentation I was
> able to get a script to be triggered, but I'm not sure how to get the
> text being committed to be passed to the script.  I've looked at the
> documentation below for hints on parameters that can be passed to
> scripts but none of them mention the text of the file being committed.
>
> http://www.cvsnt.org/manual/html/commit-files.html#syntax

Unless you specify otherwise, your script receives %r/%p %<s -- that  
means: "the full path to a (temporary) directory in the server" as the  
script first argument, and "a list of filenames (one per line)" coming  
 from stdin.

pseudocode:

repo_dir = argv[1] # get first program argument
for each line in stdin:
     file_name = read_line(stdin)
     full_name = repo_dir + '/' + file_name
     # open full_name (if it exists) and validate its contents
     # anything you write to stdout will be echoed on the client side
# program exit code should be 0 if all went OK, and >0 to cancel the  
commit operation

(one invocation per directory; note that the file may have been just  
added, modified, or deleted)

-- 
Gabriel Genellina



More information about the cvsnt mailing list