/[svn2cvs]/trunk/svn2cvs.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/svn2cvs.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 27 by dpavlin, Thu Aug 16 15:27:09 2007 UTC revision 31 by dpavlin, Wed Sep 5 20:39:29 2007 UTC
# Line 48  sub cd_rep { Line 48  sub cd_rep {
48  print "## using TMPDIR $TMPDIR\n";  print "## using TMPDIR $TMPDIR\n";
49    
50  # cvs command with root  # cvs command with root
51  my $cvs="cvs -d $CVSROOT";  my $cvs="cvs -f -d $CVSROOT";
52    
53  # current revision in CVS  # current revision in CVS
54  my $rev;  my $rev;
# Line 78  sub commit_svnrev { Line 78  sub commit_svnrev {
78          my $path=".svnrev";          my $path=".svnrev";
79    
80          if ($add_new) {          if ($add_new) {
81                  system "$cvs add $path" || die "cvs add of $path failed: $!";                  system "$cvs add '$path'" || die "cvs add of $path failed: $!";
82          } else {          } else {
83                  my $msg="subversion revision $rev commited to CVS";                  my $msg="subversion revision $rev commited to CVS";
84                  print "$msg\n";                  print "$msg\n";
85                  system "$cvs commit -m '$msg' $path" || die "cvs commit of $path failed: $!";                  system "$cvs commit -m '$msg' '$path'" || die "cvs commit of $path failed: $!";
86          }          }
87  }  }
88    
# Line 99  sub add_dir($$) { Line 99  sub add_dir($$) {
99                  next if in_entries($curr_dir);                  next if in_entries($curr_dir);
100                  next if (-e "$curr_dir/CVS");                  next if (-e "$curr_dir/CVS");
101    
102                  log_system("$cvs add $curr_dir", "cvs add of $curr_dir failed");                  log_system("$cvs add '$curr_dir'", "cvs add of $curr_dir failed");
103          }          }
104  }  }
105    
# Line 293  foreach my $e (@{$xml->{'logentry'}}) { Line 293  foreach my $e (@{$xml->{'logentry'}}) {
293                  my $msg = $e->{'msg'};                  my $msg = $e->{'msg'};
294                  $msg =~ s/'/'\\''/g;    # quote "                  $msg =~ s/'/'\\''/g;    # quote "
295    
296                  if ($action =~ /M/) {                  sub add_path {
297                          print "svn2cvs: modify $path -- nop\n";                          my $path = shift || die "no path?";
298                  } elsif ($action =~ /A/) {          
299                          if (-d $path) {                          if (-d $path) {
300                                  add_dir($path, $msg);                                  add_dir($path, $msg);
301                          } elsif ($path =~ m,^(.+)/[^/]+$, && ! -e "$1/CVS/Root") {                          } elsif ($path =~ m,^(.+)/[^/]+$, && ! -e "$1/CVS/Root") {
302                                  my $dir = $1;                                  my $dir = $1;
303                                  in_entries($dir) || add_dir($dir, $msg);                                  in_entries($dir) || add_dir($dir, $msg);
304                                  in_entries($path) || log_system("$cvs add $path", "cvs add of $path failed");                                  in_entries($path) || log_system("$cvs add '$path'", "cvs add of $path failed");
305                            } else {
306                                    in_entries($path) || log_system("$cvs add '$path'", "cvs add of $path failed");
307                            }
308                    }
309    
310                    if ($action =~ /M/) {
311                            if ( in_entries( $path ) ) {
312                                    print "svn2cvs: modify $path -- nop\n";
313                          } else {                          } else {
314                                  in_entries($path) || log_system("$cvs add $path", "cvs add of $path failed");                                  print "WARNING: modify $path which isn't in CVS, adding...\n";
315                                    add_path($path);
316                          }                          }
317                    } elsif ($action =~ /A/) {
318                            add_path($path);
319                  } elsif ($action =~ /D/) {                  } elsif ($action =~ /D/) {
320                          if (-e $path) {                          if (-e $path) {
321                                  unlink $path || die "can't delete $path: $!";                                  unlink $path || die "can't delete $path: $!";
322                                  log_system("$cvs delete $path", "cvs delete of $path failed");                                  log_system("$cvs delete '$path'", "cvs delete of $path failed");
323                          } else {                          } else {
324                                  print "WARNING: $path is not present, skipping...\n";                                  print "WARNING: $path is not present, skipping...\n";
325                                  undef $path;                                  undef $path;
# Line 326  foreach my $e (@{$xml->{'logentry'}}) { Line 337  foreach my $e (@{$xml->{'logentry'}}) {
337          $msg =~ s/'/'\\''/g;    # quote "          $msg =~ s/'/'\\''/g;    # quote "
338    
339          # now commit changes          # now commit changes
340          log_system("$cvs commit -m '$msg' ".join(" ",@commit), "cvs commit of ".join(",",@commit)." failed");          log_system("$cvs commit -m '$msg' '".join("' '",@commit)."'", "cvs commit of ".join(",",@commit)." failed");
341    
342          commit_svnrev($rev);          commit_svnrev($rev);
343  }  }

Legend:
Removed from v.27  
changed lines
  Added in v.31

  ViewVC Help
Powered by ViewVC 1.1.26