225 |
exit 0; |
exit 0; |
226 |
} |
} |
227 |
|
|
|
# my ($dir,$file) = dir_file($path); |
|
|
sub dir_file($) { |
|
|
my $path = shift; |
|
|
if ($path !~ m,^(.*?/*)([^/]+)$,) { |
|
|
die "can't split '$path' to dir and file!"; |
|
|
} else { |
|
|
my ($d,$f) = ($1,$2); |
|
|
if ($d !~ m,/$, && $d ne "") { |
|
|
$d .= "/"; |
|
|
} |
|
|
return ($d,$f); |
|
|
} |
|
|
} |
|
|
|
|
228 |
# return all files in CVS/Entries |
# return all files in CVS/Entries |
229 |
sub entries($) { |
sub entries($) { |
230 |
my $dir = shift; |
my $dir = shift; |
231 |
die "entries expects directory argument!" unless -d $dir; |
die "entries expects directory argument!" unless -d $dir; |
232 |
my @entries; |
my @entries; |
233 |
open(my $fh, "$dir/CVS/Entries") || return 0; |
open(my $fh, "./$dir/CVS/Entries") || return 0; |
234 |
while(<$fh>) { |
while(<$fh>) { |
235 |
if ( m{^D/([^/]+)}, ) { |
if ( m{^D/([^/]+)}, ) { |
236 |
my $sub_dir = $1; |
my $sub_dir = $1; |
251 |
# check if file exists in CVS/Entries |
# check if file exists in CVS/Entries |
252 |
sub in_entries($) { |
sub in_entries($) { |
253 |
my $path = shift; |
my $path = shift; |
254 |
my ($dir,$file) = dir_file($path); |
if ($path =~ m,^(.*?/*)([^/]+)$,) { |
255 |
open(E, "$dir/CVS/Entries") || return 0; |
my ($dir,$file) = ($1,$2); |
256 |
while(<E>) { |
if ($dir !~ m,/$, && $dir ne "") { |
257 |
return(1) if (m,^/$file/,); |
$dir .= "/"; |
258 |
|
} |
259 |
|
|
260 |
|
open(my $fh, "./$dir/CVS/Entries") || return 0; #die "no entries file: $dir/CVS/Entries"; |
261 |
|
while(<$fh>) { |
262 |
|
return 1 if (m{^/$file/}); |
263 |
|
} |
264 |
|
close($fh); |
265 |
|
return 0; |
266 |
|
} else { |
267 |
|
die "can't split '$path' to dir and file!"; |
268 |
} |
} |
|
close(E); |
|
|
return 0; |
|
269 |
} |
} |
270 |
|
|
271 |
cd_tmp; |
cd_tmp; |
375 |
log_system("$cvs delete '$path'", "cvs delete of file $path failed"); |
log_system("$cvs delete '$path'", "cvs delete of file $path failed"); |
376 |
cvs_commit($msg, @sub_commit, $path); |
cvs_commit($msg, @sub_commit, $path); |
377 |
log_system("$cvs update -dP '$path'", "cvs update -dP $path failed"); |
log_system("$cvs update -dP '$path'", "cvs update -dP $path failed"); |
378 |
|
undef $path; |
379 |
} else { |
} else { |
380 |
warn "#### remove file: $path"; |
warn "#### remove file: $path"; |
381 |
unlink($path) || die "can't delete $path: $!"; |
unlink($path) || die "can't delete $path: $!"; |