I actually wrote a nifty web-based code review tool that is built around CVS. (I might release it someday if my company will allow it :) Here is how I did the CVS part of it. This code uses IPC to talk to CVS and retrieves a specific version number out of CVS and runs it through enscript to color-code it. The enscript part is just for fun :)
my $cobin = "/usr/local/bin/co";
my $enscript = "/usr/local/bin/enscript";
my $cvs_repos = "/path/to/cvs/repository";
my $rev = "1.1"
my $file = "script.pl";
open(CVS, "$cobin -r$rev -p $cvs_repos/$file 2>&1 |");
@code = <CVS>;
# write it to a temp file so enscript can use it
open(TMPCVS, ">/tmp/tmpcvs.$$");
foreach (@code) { print TMPCVS $_; }
close(CVS, TMPCVS);
# the 2>/dev/null drops all stderr text, which is usually "output left
+ in -". This would have ended up either in the code
# or the log file.
open(ENSCRIPT, "$enscript --pretty-print=perl -G --language=html --col
+or -p- /tmp/tmpcvs.$$ 2>/dev/null |");
my @source = <ENSCRIPT>;
close(ENSCRIPT);
unlink("/tmp/tmpcvs.$$");
Probably a little bit more there than what you needed, but hopefully that can help answer your question. You might also want to check out the Python script
ViewCVS. I fumbled my way through this in order to figure out how to use the 'co' command.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.