151 |
exit 0; |
exit 0; |
152 |
} |
} |
153 |
|
|
154 |
|
# check if file exists in CVS/Entries |
155 |
|
sub in_entries($) { |
156 |
|
my $path = shift; |
157 |
|
if ($path !~ m,^(.*?/*)([^/]+)$,) { |
158 |
|
die "can't split '$path' to dir and file!"; |
159 |
|
} else { |
160 |
|
my ($d,$f) = ($1,$2); |
161 |
|
if ($d !~ m,/$,) { |
162 |
|
$d .= "/"; |
163 |
|
} |
164 |
|
open(E, $d."CVS/Entries") || die "can't open ${d}CVS/Entries: $!"; |
165 |
|
while(<E>) { |
166 |
|
return(1) if (m,^/$f/,); |
167 |
|
} |
168 |
|
close(E); |
169 |
|
return 0; |
170 |
|
} |
171 |
|
} |
172 |
|
|
173 |
foreach my $e (@{$xml->{'logentry'}}) { |
foreach my $e (@{$xml->{'logentry'}}) { |
174 |
die "BUG: revision from .svnrev ($rev) greater than from subversion (".$e->{'revision'}.")" if ($rev > $e->{'revision'}); |
die "BUG: revision from .svnrev ($rev) greater than from subversion (".$e->{'revision'}.")" if ($rev > $e->{'revision'}); |
175 |
$rev = $e->{'revision'}; |
$rev = $e->{'revision'}; |
180 |
my $tmpsvn = $SVNROOT || die "BUG: SVNROOT empty!"; |
my $tmpsvn = $SVNROOT || die "BUG: SVNROOT empty!"; |
181 |
my $tmppath = $e->{'paths'}->{'path'}->[0]->{'content'} || die "BUG: tmppath empty!"; |
my $tmppath = $e->{'paths'}->{'path'}->[0]->{'content'} || die "BUG: tmppath empty!"; |
182 |
do { |
do { |
|
print "## tmppath: $tmppath tmpsvn: $tmpsvn SVNREP: $SVNREP\n"; |
|
183 |
if ($tmpsvn =~ s,(/\w+/*)$,,) { |
if ($tmpsvn =~ s,(/\w+/*)$,,) { |
184 |
$SVNREP .= $1; |
$SVNREP .= $1; |
185 |
} else { |
} else { |
186 |
die "ERROR: can't deduce svn dir from $SVNROOT.\nUsing root of snv repository for current version instead of /trunk/ is not supported.\n"; |
print "NOTICE: can't deduce svn dir from $SVNROOT - skipping\n"; |
187 |
|
next; |
188 |
} |
} |
189 |
} until ($tmppath =~ m/^$SVNREP/); |
} until ($tmppath =~ m/^$SVNREP/); |
190 |
|
|
206 |
} |
} |
207 |
|
|
208 |
my $msg = $e->{'msg'}; |
my $msg = $e->{'msg'}; |
209 |
$msg =~ s/'/\\'/g; # quote " |
$msg =~ s/'/'\\''/g; # quote " |
210 |
|
|
211 |
if ($action =~ /M/) { |
if ($action =~ /M/) { |
212 |
print "svn2cvs: modify $path -- nop\n"; |
print "svn2cvs: modify $path -- nop\n"; |
217 |
chdir("$TMPDIR") || die "can't cd to $TMPDIR/$CVSREP: $!"; |
chdir("$TMPDIR") || die "can't cd to $TMPDIR/$CVSREP: $!"; |
218 |
log_system("$cvs checkout $CVSREP/$path", "cvs checkout of imported dir $path failed"); |
log_system("$cvs checkout $CVSREP/$path", "cvs checkout of imported dir $path failed"); |
219 |
chdir("$TMPDIR/$CVSREP") || die "can't cd back to $TMPDIR/$CVSREP: $!"; |
chdir("$TMPDIR/$CVSREP") || die "can't cd back to $TMPDIR/$CVSREP: $!"; |
220 |
|
} elsif ($path =~ m,^(.+)/[^/]+$, && ! -e "$1/CVS/Root") { |
221 |
|
my $dir = $1; |
222 |
|
in_entries($dir) || log_system("$cvs add $dir", "cvs add of dir $dir failed"); |
223 |
|
in_entries($path) || log_system("$cvs add $path", "cvs add of $path failed"); |
224 |
} else { |
} else { |
225 |
log_system("$cvs add -m '$msg' $path", "cvs add of $path failed"); |
in_entries($path) || log_system("$cvs add $path", "cvs add of $path failed"); |
226 |
} |
} |
227 |
} elsif ($action =~ /D/) { |
} elsif ($action =~ /D/) { |
228 |
log_system("$cvs delete -m '$msg' $path", "cvs delete of $path failed"); |
unlink $path || die "can't delete $path: $!"; |
229 |
|
log_system("$cvs delete $path", "cvs delete of $path failed"); |
230 |
} else { |
} else { |
231 |
print "WARNING: action $action not implemented on $path. Bug or missing feature of $0\n"; |
print "WARNING: action $action not implemented on $path. Bug or missing feature of $0\n"; |
232 |
} |
} |
319 |
Subversion repository. It is designed for one-time conversions, not for |
Subversion repository. It is designed for one-time conversions, not for |
320 |
repeated synchronizations between CVS and Subversion. |
repeated synchronizations between CVS and Subversion. |
321 |
|
|
322 |
|
=head1 CHANGES |
323 |
|
|
324 |
|
Versions of this utility are actually Subversion repository revisions, |
325 |
|
so they might not be in sequence. |
326 |
|
|
327 |
|
=over 3 |
328 |
|
|
329 |
|
=item r10 |
330 |
|
|
331 |
|
First release available to public |
332 |
|
|
333 |
|
=item r15 |
334 |
|
|
335 |
|
Addition of comprehensive documentation, fixes for quoting in commit |
336 |
|
messages, and support for skipping changes which are not under current |
337 |
|
Subversion checkout root (e.g. branches). |
338 |
|
|
339 |
|
=back |
340 |
|
|
341 |
=head1 AUTHOR |
=head1 AUTHOR |
342 |
|
|
343 |
Dobrica Pavlinusic <dpavlin@rot13.org> |
Dobrica Pavlinusic <dpavlin@rot13.org> |