Changeset 270 for trunk/dasscm
- Timestamp:
- Mar 4, 2009, 7:58:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r268 r270 161 161 } 162 162 163 164 # 165 # check and evaluate environment variables 166 # 163 167 sub check_env() 164 168 { … … 259 263 } 260 264 265 266 267 # 268 # has been intendend, 269 # to check addtitional parameters. 270 # Currently not used. 271 # 261 272 sub check_parameter(@) 262 273 { … … 275 286 # make filename absolut 276 287 if ( !( $filename_prod =~ m/^\// ) ) { 277 $filename_prod = cwd() . "/". $filename_prod;288 $filename_prod = cwd() . '/' . $filename_prod; 278 289 } 279 290 … … 284 295 # TODO: dirname buggy: eg. "/etc/" is reduced to "/", 285 296 # "/etc" is used as filename 286 my $dirname_prod = dirname($filename_prod); 297 # therefore make sure, that if filename is a directory, 298 # it will end by "/" 299 if( ( -d $filename_prod ) and ( !( $filename_prod =~ m/\/$/ ) ) ) { 300 $filename_prod = $filename_prod . '/'; 301 } 302 303 ( my $basename, my $dirname_prod ) = fileparse($filename_prod); 287 304 288 305 # uses chdir to determine real directory in a unique way 289 306 chdir $dirname_prod or die $!; 290 $dirname_prod = cwd() ;307 $dirname_prod = cwd() . '/'; 291 308 chdir $StartDirectory; 292 293 my $basename = basename($filename_prod);294 309 295 310 if ($verbose) { … … 460 475 sub svn_update( ;$ ) 461 476 { 477 my $update_path = shift || ""; 478 479 # use this flag to do only one update per run 462 480 if( ! $svnRepositoryIsUptodate ) { 463 my $update_path = shift || $DASSCM_REPO;464 481 ( my $rc_update, my @result ) = 465 482 run_command( 466 "$SVN update --non-interactive $svnCheckoutCredentials $update_path");483 "$SVN update --non-interactive $svnCheckoutCredentials '$DASSCM_REPO/$update_path'"); 467 484 print @result; 468 485 if ( $rc_update != 0 ) { 469 486 fatalerror(); 470 } else { 487 } elsif ( not $update_path ) { 488 # set this flag if a full update is done 471 489 $svnRepositoryIsUptodate = 1; 472 490 } … … 476 494 477 495 478 sub svn_getStoredFiles( ;$ ) 479 { 480 481 # TODO: get_filenames? 482 #my $rel_path = shift || ""; 483 #my $path = "${DASSCM_REPO}/${rel_path}"; 484 my $path = ${DASSCM_REPO}; 496 sub svn_getStoredFiles( ;@ ) 497 { 498 ( 499 my $basename, 500 my $dirname_prod, 501 my $dirname_repo, 502 my $filename_prod, 503 my $filename_repo 504 ) 505 = get_filenames( $_[0] ); 485 506 486 507 # svn ls -R is better, but much, much slower 487 508 # ( my $rc, my @result ) = run_command("$SVN ls --recursive $svnCheckoutCredentials $path"); 509 510 # without the last true, run_command returns an error, if result is empty (?) 511 # TODO: replace by perl find 488 512 ( my $rc, my @result ) = 489 513 run_command( 490 "cd $ path && find | grep -v '/.svn' | sed -e 's/\.\\///' | grep -v '^[\.]\$'"514 "cd $dirname_repo && find | grep -v '/.svn' | sed -e 's|\.\\/||' | grep -v '^[\.]\$'; true" 491 515 ); 492 516 if ( $rc != 0 ) { 493 517 print @result; 494 fatalerror ;518 fatalerror('failed to get stored files'); 495 519 } 496 520 chomp(@result); … … 501 525 sub getModifiedFiles( ;$ ) 502 526 { 503 # TODO: get_filenames? 504 #my $rel_path = shift || ""; 505 #my $path = "${DASSCM_REPO}/${rel_path}"; 506 my $path = ${DASSCM_REPO}; 507 my @files = svn_getStoredFiles($path); 527 ( 528 my $basename, 529 my $dirname_prod, 530 my $dirname_repo, 531 my $filename_prod, 532 my $filename_repo 533 ) 534 = get_filenames( $_[0] ); 535 536 my @files = svn_getStoredFiles( $dirname_prod ); 508 537 509 538 # stores result from status (cvscheck) … … 818 847 check_env(); 819 848 820 # TODO: get_filenames?821 #my $rel_path = shift || "";822 #my $path = "${DASSCM_REPO}/${rel_path}";823 my $dir = ${DASSCM_REPO};824 825 849 # 826 850 # update local repository … … 828 852 svn_update(); 829 853 830 ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dir);854 ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( "/" ); 831 855 my %changedfiles = %{$refChangedFiles}; 832 856 my %removedfiles = %{$refRemovedFiles}; … … 896 920 check_env(); 897 921 922 ( 923 my $basename, 924 my $dirname_prod, 925 my $dirname_repo, 926 my $filename_prod, 927 my $filename_repo 928 ) 929 = get_filenames( $_[0] || "/" ); 930 931 898 932 # return code for the shell 899 933 # default: error … … 905 939 svn_update(); 906 940 907 # TODO: start at subdirectories ? 908 my $dir = $DASSCM_REPO; 909 ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dir ); 941 ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $dirname_prod ); 910 942 my %changedfiles = %{$refChangedFiles}; 911 943 my %removedfiles = %{$refRemovedFiles}; … … 927 959 } 928 960 } else { 929 print "no modified files found in $dir \n";961 print "no modified files found in $dirname_repo\n"; 930 962 $return_code = $RETURN_OK; 931 963 } … … 936 968 937 969 938 sub permissions( @)970 sub permissions() 939 971 { 940 972 check_parameter( @_, 1 ); … … 946 978 #svn_update(); 947 979 948 # TODO: start at subdirectories ?949 980 my $dir = $DASSCM_REPO; 950 my @files = svn_getStoredFiles( $dir);981 my @files = svn_getStoredFiles( "/" ); 951 982 952 983 if (@files) { … … 1074 1105 } elsif (m/permissions/i) { 1075 1106 $command = "permissions"; 1076 permissions( @ARGV);1107 permissions(); 1077 1108 } else { 1078 1109 print "unknown command: $command\n\n";
Note:
See TracChangeset
for help on using the changeset viewer.