Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

CVS repository via Perl

by shushu (Scribe)
on Nov 05, 2002 at 11:32 UTC ( #210429=perlquestion: print w/replies, xml ) Need Help??

shushu has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

I am trying to develop specific process of working with CVS via Perl.
Clearly, ther should not be any reason why to write it all from start, that what I thought, but starting to look for a proper resource/module gave me other results.

I think I am wrong, and there is probebly something I missed.

Here is what I found until now:
- cvsweb/cvsweb-FreeBSD/cvsweb+cvsedit - all written in Perl, but all CGI-related and not module.
Not good for me.

- VCS modules - look promising, but seems to work on a copy of the repository (I mean - you have to checkout before you start...). VCSWEB did not work properly for me anyway.
Not good for me.

- Apache::CVS - module that do similar things to cvsweb, but a module. Since it is an Apache module, I think it is not good for me.

- cvs2html - Another Perl script. Not a module.

- mod_cvs - I could not even reach its web site. What exactly is it ?

Well, Monks, I would love to get some ideas here before I start to write my own module...

And another thing - if anyone can answer me the following questions I would appriciate it:
1. Can I work with Apache::CVS modules not via Apache/HTML ? It looks like it, but I am not sure.

2. Why the hell VCS is not designed to work on the repository ?

3. Does anybody answer the task of taking the splendid cvsweb and "modulate" it ?

TIA,
shushu

Replies are listed 'Best First'.
Re: CVS repository via Perl
by davorg (Chancellor) on Nov 05, 2002 at 13:00 UTC
    2. Why the hell VCS is not designed to work on the repository ?

    Surely most interaction with a CVS repository should be thru a working copy?

    VCS.pm seems to be pretty well supported. There is a project page on Sourceforge and also a mailing list. Why not ask on there?

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: CVS repository via Perl
by zakb (Pilgrim) on Nov 05, 2002 at 13:44 UTC

    As Dave says, I think you should look again at VCS.

    From your query about VCS, I think you may have misunderstood how CVS works. I had this same problem at first, because I had previously used PVCS and SourceSafe, which use the same terms to mean different things.

    With CVS, your "project" is a "module" and to even look at it (e.g. to see it's structure in terms of files and directories), you must "checkout" the module to a working directory - this is effectively the same as a "Get Latest Version" in SourceSafe parlance. As far as I'm aware, you can't examine a file from the repository without taking a working copy, unlike SourceSafe and PVCS.

    To modify a file, you "edit" it - the same as a checkout in SourceSafe, but beware, CVS edits are not exclusive by default. To save your changes in the repository, you "commit" - the same as a SourceSafe checkin.

    Hope this helps!

      Hi, Thanks for the feedback.
      I did look into VCS support, and went over their mailing list archive. First of all - it is very quiet there. Second - it gives no information except "look at our examples". Well - I looked into them, and they work with a copy, after cehckout.

      Now to the question - do I understand CVS, because if I do understand why won't I "checkout" before I start to work.
      Well, let's just say I know CVS well enough.
      If you will look into cvsweb for example, or Apache::CVS, they both work direcrly with the CVS repository, and whenever they can't - they immitate a working directory or do some "magic" to solve this problem (look into cvsweb doAnnotate, for example, where they use cvs server command).
      The reasons I need a direct work with a repository are complicated (maybe another message...), but in the bottom line I need to keep live and updated branches (around 4 branches) that weight 200MB each on more then 20 machines.
      Just keeping a copy of all of the branches on every machine will be a headache.

      What I currently try to do is to immitate Apache request. If I will succeed I will be able to work with Apache::CVS not via the Apache.
      I am not sure it is such a good idea, but I will give it a shot since it can short my development process a lot.

      Any more ideas ?
      Thanks,
      shushu
        Hi again,
        I think I have the solution I needed.
        Using Apache::CVS::* modules directly seems to give me exactly what I need.

        See the code below that brings me the last revision of a file:
        use Apache::CVS::RcsConfig(); use Apache::CVS::PlainFile(); use Apache::CVS::Directory(); use Apache::CVS::File(); use Apache::CVS::Revision(); # /tmp/remote/ is the directory of my CVS module in the repository my $PATH = "/tmp/remote//VC_DB/utilities/pack_conf.pl"; my $RCSCONFIG = Apache::CVS::RcsConfig->new(); my $file = Apache::CVS::File->new($PATH, $RCSCONFIG); my $LAST = $file->revision('prev'); print $LAST->content;

        In addition, all of the Apache::CVS::* modules can give a nice and working direct access to the CVS repository.
        The main idea is - you don't need to know how it is done !

        I believe those modules should be moved from below Apache.

        Have a nice day,
        shushu

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://210429]
Approved by smitz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2021-10-17 06:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (71 votes). Check out past polls.

      Notices?