--- trunk/svn2cvs.pl 2004/03/13 15:44:04 11 +++ trunk/svn2cvs.pl 2004/03/13 17:22:53 12 @@ -8,6 +8,8 @@ # http://raw.no/personal/blog # # 2004-03-09 Dobrica Pavlinusic +# +# documentation is after __END__ use strict; use File::Temp qw/ tempdir /; @@ -81,7 +83,7 @@ Your CVS repository doesn't have .svnrev file! -This file is used to keep CVS repository and SubVersion in sync, so +This file is used to keep CVS repository and Subversion in sync, so that only newer changes will be commited. It's quote possible that this is first svn2cvs run for this repository. @@ -90,8 +92,8 @@ been checkouted. If you migrated your cvs repository to svn using cvs2svn, this will be -last SubVersion revision. If this is initial run of conversion of -SubVersion repository to CVS, correct revision is 0. +last Subversion revision. If this is initial run of conversion of +Subversion repository to CVS, correct revision is 0. _USAGE_ @@ -133,19 +135,19 @@ my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]); -=begin log_example - ------------------------------------------------------------------------- -r256 | dpavlin | 2004-03-09 13:18:17 +0100 (Tue, 09 Mar 2004) | 2 lines - -ported r254 from hidra branch - -=cut +#=begin log_example +# +#------------------------------------------------------------------------ +#r256 | dpavlin | 2004-03-09 13:18:17 +0100 (Tue, 09 Mar 2004) | 2 lines +# +#ported r254 from hidra branch +# +#=cut my $fmt = "\n" . "-" x 79 . "\nr%5s| %8s | %s\n\n%s\n"; if (! $xml->{'logentry'}) { - print "no newer log entries in SubVersion repostory. CVS is current\n"; + print "no newer log entries in Subversion repostory. CVS is current\n"; exit 0; } @@ -212,3 +214,96 @@ commit_svnrev($rev); } + +__END__ + +=pod + +=head1 NAME + +svn2cvs - save subversion commits to (read-only) cvs repository + +=head1 SYNOPSIS + + ./svn2cvs.pl SVN_URL CVSROOT CVSREPOSITORY + +Usage example (used to self-host this script): + + ./svn2cvs.pl file:///home/dpavlin/private/svn/svn2cvs/trunk/ \ + :pserver:dpavlin@cvs.tigris.org:/cvs svn2cvs/src + +=head1 DESCRIPTION + +This script will allow you to commit changes made to Subversion repository also to (read-only) CVS repository manually or from Subversion's C hook. + +It's using F<.svnrev> file (which will be created on first run) in +B to store last Subversion revision which was +committed into CVS. + +One run will do following things: + +=over 4 + +=item * +checkout B from B to temporary directory + +=item * +check if F<.svnrev> file exists and create it if it doesn't + +=item * +loop through all revisions from current in B (using +F<.svnrev>) up to B (current one) + +=over 5 + +=item * +checkout next Subversion revision from B over CVS checkout +temporary directory + +=item * +make modification (add and/or delete) done in that revision + +=item * +commit modification (added, deleted or modified files/dirs) while +preserving original message from CVS + +=item * +update F<.svnrev> to match current revision + +=back + +=item * +cleanup temporary directory + +=back + +If checkout fails for some reason (e.g. flaky ssh connection), you will +still have valid CVS repository, so all you have to do is run B +again. + +=head1 WARNINGS + +"Cheap" copy operations in Subversion are not at all cheap in CVS. They will +create multiple copies of files in CVS repository! + +=head1 RELATED PROJECTS + +B L version control system that is a +compelling replacement for CVS in the open source community. + +B L converts a CVS repository to a +Subversion repository. It is designed for one-time conversions, not for +repeated synchronizations between CVS and Subversion. + +=head1 AUTHOR + +Dobrica Pavlinusic + +L + +=head1 LICENSE + +This product is licensed under GNU Public License (GPL) v2 or later. + +=cut +