version control - Use the commit message in a CVS pre-commit hook -
Is it possible to use a committed message in a pre-committed hook in CVS? The CVS server is running remotely, and I access it using pserver
.
Ideally, if I include some text in the filter or committed message.
I have no choice but to use other versioning system.
Here are some useful tutorials for reading:
You can not do whatever you want with only one hook but you use two hooks, commitinfo
will allow you to verify the files yourself and verifymsg
lets you verify the message can be used to reduce both (the program only needs to exit with Status 1) If you did not know, then checkoutlists
, commitinfo
and 'verifymsg' can all be found in the CVSROT directory of your repository. I recommend writing any script as hook in that directory, but it does not really matter as you get to specify the full path. Also, Perl is not required or necessary, just writing some (silly) examples for me is easy:
checkoutlists
# These files are automatically for you Check out will be acceptable
verifymsg
# Specifies which file to run as a hook,% l file of the log message file name # Bar $ / path / to / repo / CVSROOT / Verify_ends_in_bar% l DEFAULT / path / to / repo / cvsroot / Acceptable% l% s
Acceptable
# / usr / bin / perl -w Kht use; Use warnings; # It would be easy if CVS passed my arguments ($ logfile, $ dir, @files) = @ARGV; Accept the liability of my $ grep = `grep-i '' $ logfile`; Quit 0 if $ grep; My $ found = 0; Follow my $ file (@file) (my $ path = add '/', $ dir, $ file; die "file $ path can not be found" if! -a $ path; my $ grep = `grep - I 'Proof of' $ path 'of any explanation; $ found ++ if $ grep;} "If you should accept liability or show evidence of deliberations" If $ got & lt; @files;
Cavity operator: I wrote it without the majority of the test, at the top of my head, so I can not guarantee it to work, but it comes
Re-edit , I realized that I was basically wrong and that both the logfile and committed filenames verifymsg
can make the answer a little simpler.
Comments
Post a Comment