Changeset 271
- Timestamp:
- Mar 4, 2009, 9:40:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r270 r271 323 323 324 324 325 sub copy_file_to_repository( $ ) 326 { 327 my $filename = shift; 328 329 ( 330 my $basename, 331 my $dirname_prod, 332 my $dirname_repo, 333 my $filename_prod, 334 my $filename_repo 335 ) 336 = get_filenames( $filename ); 337 338 # TODO: are permissions also copied? 339 340 print "$filename: $filename_prod, $filename_repo\n"; 341 copy( $filename_prod, $filename_repo ) 342 or error "failed to copy $filename_prod to repository: $!"; 343 } 344 325 345 326 346 # … … 494 514 495 515 496 sub svn_ getStoredFiles( ;@ )516 sub svn_ls( ;@ ) 497 517 { 498 518 ( … … 508 528 # ( my $rc, my @result ) = run_command("$SVN ls --recursive $svnCheckoutCredentials $path"); 509 529 510 # without the last true, run_command returns an error, if result is empty (?) 511 # TODO: replace by perl find 512 ( my $rc, my @result ) = 513 run_command( 514 "cd $dirname_repo && find | grep -v '/.svn' | sed -e 's|\.\\/||' | grep -v '^[\.]\$'; true" 515 ); 516 if ( $rc != 0 ) { 517 print @result; 518 fatalerror('failed to get stored files'); 519 } 520 chomp(@result); 521 return @result; 530 my @files = (); 531 my @links = (); 532 my @dirs = (); 533 my @others = (); 534 535 if( -f $filename_prod ) { 536 @files = ( $filename_prod ); 537 } elsif ( -d $dirname_repo ) { 538 find( 539 { 540 wanted => sub { 541 my $name = $File::Find::name; 542 $name =~ s|^$dirname_repo||; 543 if ( $name =~ m/\.svn/ ) { 544 # skip svn meta data 545 } elsif ( -l $_ ) { 546 547 # soft link 548 # important: check for links first 549 # to exclude them from further checks 550 push( @links, $name ); 551 } elsif ( -d $_ ) { 552 553 # directories 554 push( @dirs, $name ); 555 } elsif ( -f $_ ) { 556 557 # regular file 558 push( @files, $name ); 559 } else { 560 push( @others, $name ); 561 } 562 } 563 }, 564 ( $dirname_repo ) 565 ); 566 } 567 568 return @files; 522 569 } 523 570 … … 534 581 = get_filenames( $_[0] ); 535 582 536 my @files = svn_ getStoredFiles( $dirname_prod );583 my @files = svn_ls( $filename_prod ); 537 584 538 585 # stores result from status (cvscheck) … … 545 592 foreach my $file (@files) { 546 593 547 my $realfile = "/". $file;548 my $cvsworkfile = "${DASSCM_REPO}/${file}";594 my $realfile = $dirname_prod . $file; 595 my $cvsworkfile = $dirname_repo . $file; 549 596 550 597 if ( -d $realfile ) { … … 590 637 push( @links, $fullname ); 591 638 } elsif ( -d $_ ) { 639 640 # directories 592 641 push( @dirs, $fullname ); 593 642 } elsif ( -f $_ ) { … … 706 755 check_env(); 707 756 708 my @files = svn_ getStoredFiles(@_);757 my @files = svn_ls(@_); 709 758 710 759 print join( "\n", @files ); … … 870 919 871 920 921 # 922 # checks in all modified files 923 # 924 sub commit(@) 925 { 926 check_parameter( @_, 1 ); 927 check_env(); 928 929 ( 930 my $basename, 931 my $dirname_prod, 932 my $dirname_repo, 933 my $filename_prod, 934 my $filename_repo 935 ) 936 = get_filenames( $_[0] ); 937 938 939 # 940 # update local repository 941 # 942 svn_update(); 943 944 ( my $refChangedFiles, my $refRemovedFiles ) = getModifiedFiles( $filename_prod ); 945 my %changedfiles = %{$refChangedFiles}; 946 my %removedfiles = %{$refRemovedFiles}; 947 948 if( %removedfiles ) { 949 my $removedFilesString = '"' . join( '" "', values(%removedfiles) ) . '"'; 950 my ( $rc, @out ) = run_command( "$SVN rm $removedFilesString" ); 951 if ( $rc > 0 ) { 952 print join( "\n", @out ); 953 } 954 } 955 956 # copy files one by one to local repository 957 for my $file ( keys(%changedfiles) ) { 958 copy_file_to_repository( $file ); 959 } 960 961 # create new permissions file 962 permissions(); 963 964 # add permissions file 965 add_helper($permissions_file); 966 967 if ( $options{'message'} ) { 968 $svnOptions .= " --message \"$options{'message'}\" "; 969 } 970 971 # commit calls $EDITOR. 972 # use "interactive" here, to display output 973 my $retcode = 974 run_interactive( 975 "$SVN commit $svnOptions --username '$DASSCM_USERNAME' $svnPasswordCredentials $DASSCM_REPO" 976 ); 977 } 978 979 980 872 981 sub blame(@) 873 982 { … … 979 1088 980 1089 my $dir = $DASSCM_REPO; 981 my @files = svn_ getStoredFiles( "/" );1090 my @files = svn_ls( "/" ); 982 1091 983 1092 if (@files) { … … 1093 1202 } elsif ( (m/commit/i) || (m/checkin/i) || (m/ci/i) ) { 1094 1203 $command = "commit"; 1095 add(@ARGV);1204 commit(@ARGV); 1096 1205 } elsif (m/blame/i) { 1097 1206 $command = "blame";
Note:
See TracChangeset
for help on using the changeset viewer.