Changeset 287
- Timestamp:
- Mar 9, 2009, 6:55:15 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r286 r287 278 278 } 279 279 280 281 # 282 # normalize path namens: 283 # - directories should end with "/" 284 # - use only single "/" 285 # 286 sub normalize_path($) 287 { 288 my $path = shift || ""; 289 290 if( $path =~ m|^/| ) { 291 # full path 292 if( -d $path ) { 293 # ensure, a directory ends with '/' 294 $path .= '/'; 295 } 296 } elsif( -d cwd() . '/' . $path ) { 297 # ensure, a directory ends with '/' 298 $path .= '/'; 299 } 300 301 # remove double (triple) slashes (/) 302 $path =~ s|/[/]*|/|g; 303 304 return $path; 305 } 306 307 308 280 309 # 281 310 # generate from (relative) filename … … 301 330 # herefore make sure, that if filename is a directory, 302 331 # it will end by "/" 303 if ( ( -d $filename_prod ) and ( !( $filename_prod =~ m/\/$/ ) ) ) { 304 $filename_prod = $filename_prod . '/'; 305 } 332 $filename_prod = normalize_path( $filename_prod ); 306 333 307 334 ( my $basename, my $dirname_prod ) = fileparse($filename_prod); … … 309 336 # uses chdir to determine real directory in a unique way 310 337 chdir $dirname_prod or die $!; 311 $dirname_prod = cwd() . '/';338 $dirname_prod = normalize_path( cwd() ); 312 339 chdir $StartDirectory; 313 340 341 my $dirname_repo = normalize_path( $DASSCM_REPO . "/" . $dirname_prod ); 342 my $filename_repo = normalize_path( "$dirname_repo/$basename" ); 343 314 344 if ($verbose) { 315 print " dir: " . $dirname_prod. "\n";316 print " fn: " . $basename ."\n";317 }318 319 my $dirname_repo = $DASSCM_REPO . "/" . $dirname_prod;320 my $filename_repo = "$dirname_repo/$basename";345 print "filename_repo: " . $filename_repo . "\n"; 346 print "dirname_repo: " . $dirname_repo ."\n"; 347 print "filename_prod: " . $filename_prod . "\n"; 348 print "dirname_prod: " . $dirname_prod . "\n"; 349 print "basename: " . $basename . "\n"; 350 } 321 351 322 352 return ( … … 536 566 { 537 567 wanted => sub { 538 my $name = $File::Find::name;568 my $name = normalize_path($File::Find::name); 539 569 $name =~ s|^$dirname_repo||; 540 if ( $name =~ m/\.svn/ ) { 570 #print "($name)\n";# . $File::Find::dir . "\n"; 571 if ( not $name ) { 572 # name string is empty (top directory). 573 # do nothing 574 } elsif ( $name =~ m/\.svn/ ) { 541 575 542 576 # skip svn meta data … … 548 582 push( @links, $name ); 549 583 } elsif ( -d $_ ) { 550 551 # directories 552 push( @dirs, $name ); 584 #if( $name."/" eq dirname_repo ) { 585 # directories 586 push( @dirs, $name ); 587 #} 553 588 } elsif ( -f $_ ) { 554 589 … … 564 599 } 565 600 566 return @files; 567 } 601 return ( sort( @dirs, @files ) ); 602 } 603 604 568 605 569 606 sub svn_revert( ;$ ) … … 1163 1200 print OUTFILE 1164 1201 "# It is intended to be used for restoring permissions\n"; 1202 print OUTFILE "#\n"; 1165 1203 } else { 1166 1204
Note:
See TracChangeset
for help on using the changeset viewer.