Changeset 239
- Timestamp:
- Oct 9, 2008, 12:07:00 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r238 r239 16 16 use File::Path; 17 17 use Term::ReadKey; 18 18 19 #use Data::Dumper; 19 20 … … 80 81 " DASSCM_USERNAME\n", " DASSCM_PASSWORD\n", 81 82 " are evaluated, but set automatically by 'dasscm login'.\n", "\n", 82 " If dasscm is not yet configured, read", 83 " $doc_file\n"; 83 " If dasscm is not yet configured, read", " $doc_file\n"; 84 84 } 85 85 … … 96 96 sub fatalerror(@) 97 97 { 98 error( @_ ); 98 error(@_); 99 99 100 #print "Exiting\n"; 100 exit 1 101 } 102 101 exit 1; 102 } 103 103 104 104 # … … 107 107 sub get_config 108 108 { 109 my $file 110 111 if ( !$file ) {109 my $file = $_[0]; 110 111 if ( !$file ) { 112 112 fatalerror( "failed to open config file" . $file ); 113 113 } … … 125 125 } 126 126 if ( $_ =~ /=/g ) { 127 127 128 # splitting in 2 fields at maximum 128 129 my ( $option, $value ) = split( /=/, $_, 2 ); … … 145 146 } 146 147 147 148 148 sub check_env() 149 149 { … … 178 178 179 179 # 180 # check if local repository directory exist 180 # check if local repository directory exist 181 181 # (if not creating by init) 182 182 # … … 224 224 } 225 225 226 227 # 228 # generate from (relative) filename 226 # 227 # generate from (relative) filename 229 228 # all required file and directory names: 230 229 # $basename, $dirname_prod, $dirname_repo, … … 240 239 } 241 240 242 if ( not -r $filename_prod ) {243 fatalerror( $filename_prod 241 if ( not -r $filename_prod ) { 242 fatalerror( $filename_prod . " is not accessable" ); 244 243 } 245 244 … … 277 276 foreach my $file (@files) { 278 277 $file = "/" . $file; 279 if ( -e $file ) {280 my $info = stat( $file) || die "failed to stat $file: aborting";281 my $mode 278 if ( -e $file ) { 279 my $info = stat($file) || die "failed to stat $file: aborting"; 280 my $mode = get_type( $info->mode ) & 07777; 282 281 my $modestring = sprintf( "%04o", $mode ); 283 282 my $uid = $info->uid; … … 291 290 ); 292 291 } else { 293 print "failed to get status of $file. It exists in the repository, but not on the system\n"; 292 print 293 "failed to get status of $file. It exists in the repository, but not on the system\n"; 294 294 } 295 295 } … … 364 364 print "checking credentials ... "; 365 365 366 if ( !$username ) {367 fatalerror( "no username given");368 } 369 370 if ( !$password ) {371 fatalerror( "no password given");366 if ( !$username ) { 367 fatalerror("no username given"); 368 } 369 370 if ( !$password ) { 371 fatalerror("no password given"); 372 372 } 373 373 … … 426 426 } 427 427 428 429 428 # 430 429 # from an array of files/dirs, … … 439 438 my @others = (); 440 439 441 if( @_ ) { 442 find( { wanted => sub { 443 my $fullname = cwd() . "/" . $_; 444 if ( -l $_ ) { 445 # soft link 446 # important: check for links first 447 # to exclude them from further checks 448 push( @links, $fullname ); 449 } elsif ( -d $_ ) { 450 push( @dirs, $fullname ); 451 } elsif( -f $_ ) { 452 # regular file 453 push( @files, $fullname ); 454 } else { 455 push( @others, $fullname ); 456 } 457 } }, @_ ); 458 } 459 460 # don't rely on others. 440 if (@_) { 441 find( 442 { 443 wanted => sub { 444 my $fullname = cwd() . "/" . $_; 445 if ( -l $_ ) { 446 447 # soft link 448 # important: check for links first 449 # to exclude them from further checks 450 push( @links, $fullname ); 451 } elsif ( -d $_ ) { 452 push( @dirs, $fullname ); 453 } elsif ( -f $_ ) { 454 455 # regular file 456 push( @files, $fullname ); 457 } else { 458 push( @others, $fullname ); 459 } 460 } 461 }, 462 @_ 463 ); 464 } 465 466 # don't rely on others. 461 467 # If more specific file types are needed, 462 468 # they will be added 463 469 return { 464 files => \@files, 465 links => \@links, 466 dirs => \@dirs, 467 others => \@others 468 }; 469 } 470 471 470 files => \@files, 471 links => \@links, 472 dirs => \@dirs, 473 others => \@others 474 }; 475 } 472 476 473 477 ##################################################################### … … 511 515 print "\n"; 512 516 513 svn_check_credentials( $input_username || $DASSCM_USERNAME, $input_password ); 517 svn_check_credentials( $input_username || $DASSCM_USERNAME, 518 $input_password ); 514 519 515 520 # … … 565 570 svn_update(); 566 571 } 567 568 569 572 570 573 # … … 587 590 588 591 # TODO: are permissions also copied? 589 copy( $filename_prod, $filename_repo ) or error "failed to copy $filename_prod to repository: $!"; 592 copy( $filename_prod, $filename_repo ) 593 or error "failed to copy $filename_prod to repository: $!"; 590 594 591 595 if ( $command eq "add" ) { … … 597 601 for my $dir ( split( '/', $dirname_prod ) ) { 598 602 if ($dir) { 599 my( $rc, @out ) = run_command("$SVN add --non-recursive \"" . $dir . "\"" ); 600 if( $rc > 0 ) { 603 my ( $rc, @out ) = 604 run_command( "$SVN add --non-recursive \"" . $dir . "\"" ); 605 if ( $rc > 0 ) { 601 606 print join( "\n", @out ); 602 } 607 } 603 608 chdir $dir; 604 609 } 605 610 } 606 my ( $rc, @out ) = run_command("$SVN add \"" . $basename . "\"");607 if ( $rc > 0 ) {611 my ( $rc, @out ) = run_command( "$SVN add \"" . $basename . "\"" ); 612 if ( $rc > 0 ) { 608 613 print join( "\n", @out ); 609 } 614 } 610 615 chdir $StartDirectory; 611 616 } 612 617 } 613 614 618 615 619 # … … 627 631 628 632 # get all regular files and links 629 my $href_files = get_files( @_);633 my $href_files = get_files(@_); 630 634 631 635 #print Dumper( $href_files ); 632 636 633 my @files = @{ $href_files->{files}};634 my @links = @{ $href_files->{links}};635 636 if ( @files) {637 my @files = @{ $href_files->{files} }; 638 my @links = @{ $href_files->{links} }; 639 640 if (@files) { 637 641 my $number = $#files + 1; 638 642 print "files to check-in ($number): \n"; … … 641 645 } 642 646 643 if ( @links) {647 if (@links) { 644 648 my $number = $#links + 1; 645 649 print "\n"; … … 653 657 # copy files one by one to local repository 654 658 for my $file (@files) { 659 655 660 # add file 656 add_helper( $file);661 add_helper($file); 657 662 } 658 663 … … 667 672 } 668 673 669 # commit calls $EDITOR. 674 # commit calls $EDITOR. 670 675 # use "interactive" here, to display output 671 676 my $retcode = … … 718 723 719 724 ( my $rc_diff, my @diff_result ) = 720 run_command( $diff . " $filename_repo $filename_prod" );725 run_command( $diff . " $filename_repo $filename_prod" ); 721 726 722 727 print @diff_result;
Note:
See TracChangeset
for help on using the changeset viewer.