Changeset 801 for dasscm/trunk


Ignore:
Timestamp:
Nov 10, 2009, 6:05:01 PM (15 years ago)
Author:
joergs
Message:

cleanup before revert, perltidy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dasscm/trunk/dasscm

    r800 r801  
    332332    ( my $basename, my $dirname_prod ) = fileparse($filename_prod);
    333333
    334     # normalize path. 
     334    # normalize path.
    335335    # not done for reverting, because in this case, the directory may not exist
    336336    # and the correct path should already be stored in the repository
    337337    if ( $command ne "revert" ) {
     338
    338339        # uses chdir to determine real directory in a unique way
    339         chdir $dirname_prod or fatalerror( "failed to access directory $dirname_prod: " . $! );
     340        chdir $dirname_prod
     341          or fatalerror( "failed to access directory $dirname_prod: " . $! );
    340342        $dirname_prod = normalize_path( cwd() );
    341343        chdir $StartDirectory;
     
    369371        my $filename_prod,
    370372        my $filename_repo
    371       )
    372       = get_filenames($filename);
     373    ) = get_filenames($filename);
    373374
    374375    # TODO: are permissions also copied?
     
    376377      or error "failed to copy $filename_prod to repository: $!";
    377378}
    378 
    379379
    380380#
     
    501501    my $rc_update;
    502502    if ($interactive) {
    503         $rc_update =
    504           run_interactive(
     503        $rc_update = run_interactive(
    505504            "$SVN ls --no-auth-cache --username '$username' --password '$password' $DASSCM_SVN_REPOSITORY"
    506           );
     505        );
    507506    } else {
    508         ( $rc_update, my @result ) =
    509           run_command(
     507        ( $rc_update, my @result ) = run_command(
    510508            "$SVN ls --non-interactive --no-auth-cache --username '$username' --password '$password' $DASSCM_SVN_REPOSITORY"
    511           );
     509        );
    512510
    513511        if ( $rc_update != 0 ) {
     
    524522}
    525523
    526 
    527 
    528524sub svn_update( ;$ )
    529525{
     
    535531    # use this flag to do only one update per run
    536532    if ( !$svnRepositoryIsUptodate ) {
    537         ( my $rc_update, my @result ) =
    538           run_command(
     533        ( my $rc_update, my @result ) = run_command(
    539534            "$SVN update --non-interactive $svnCheckoutCredentials '$DASSCM_REPO/$update_path'"
    540           );
     535        );
    541536        print @result;
    542537        if ( $rc_update != 0 ) {
     
    551546    return $update_ok;
    552547}
    553 
    554 
    555548
    556549sub svn_ls( ;@ )
     
    562555        my $filename_prod,
    563556        my $filename_repo
    564       )
    565       = get_filenames( $_[0] );
     557    ) = get_filenames( $_[0] );
    566558
    567559    # svn ls -R is better, but much, much slower
     
    595587                } elsif ( -d $_ ) {
    596588
    597                     #if( $name."/" eq dirname_repo ) {
    598589                    # directories
    599590                    push( @dirs, $name );
    600 
    601                     #}
    602591                } elsif ( -f $_ ) {
    603592
     
    644633                # remove it
    645634                print "removing $_\n";
     635
    646636                # unlink doesn't work recursive, there "rm -rf" is used
    647637                #unlink($_);
    648                 system( "rm -rf $_" );
     638                system("rm -rf $_");
    649639            }
    650640        }
     
    660650        my $filename_prod,
    661651        my $filename_repo
    662       )
    663       = get_filenames( $_[0] );
     652    ) = get_filenames( $_[0] );
    664653
    665654    my @files = svn_ls($filename_prod);
     
    837826    # update complete repository
    838827    # and create permission file
    839     my $retcode =
    840       run_interactive(
     828    my $retcode = run_interactive(
    841829        "cd $DASSCM_LOCAL_REPOSITORY_BASE; $SVN checkout $svnCheckoutCredentials $svnOptions $DASSCM_SVN_REPOSITORY; mkdir -p `dirname $DASSCM_PERMISSION_FILE`; touch $DASSCM_PERMISSION_FILE"
    842       );
     830    );
    843831}
    844832
     
    878866        my $filename_prod,
    879867        my $filename_repo
    880       )
    881       = get_filenames( $_[0] );
     868    ) = get_filenames( $_[0] );
    882869
    883870    mkpath($dirname_repo);
     
    966953    # commit calls $EDITOR.
    967954    # use "interactive" here, to display output
    968     my $retcode =
    969       run_interactive(
     955    my $retcode = run_interactive(
    970956        "$SVN commit $svnOptions --username '$DASSCM_USERNAME' $svnPasswordCredentials $DASSCM_REPO"
    971       );
     957    );
    972958
    973959    # svn commit does not deliever an error return code, if commit is canceld,
     
    990976        my $filename_prod,
    991977        my $filename_repo
    992       )
    993       = get_filenames( $_[0] );
     978    ) = get_filenames( $_[0] );
    994979
    995980    #
     
    10291014    # commit calls $EDITOR.
    10301015    # use "interactive" here, to display output
    1031     my $retcode =
    1032       run_interactive(
     1016    my $retcode = run_interactive(
    10331017        "$SVN commit $svnOptions --username '$DASSCM_USERNAME' $svnPasswordCredentials $DASSCM_REPO"
    1034       );
     1018    );
    10351019
    10361020    # svn commit does not deliever an error return code, if commit is canceld,
     
    10381022    svn_revert();
    10391023}
    1040 
    1041 
    10421024
    10431025#
     
    10551037        my $filename_prod,
    10561038        my $filename_repo
    1057       )
    1058       = get_filenames( $_[0] );
     1039    ) = get_filenames( $_[0] );
    10591040
    10601041    # return code for the shell
     
    10621043    my $return_code = $RETURN_OK;
    10631044
    1064 
    10651045    # cleanup repository
    1066     ##cleanup();
     1046    cleanup();
    10671047    #svn_update();
    10681048
     
    10771057        if (%removedfiles) {
    10781058            print "DELETED files and directories. Recreated from repository:\n";
    1079             my @removedPaths = ( sort { length $a > length $b } keys %removedfiles );
     1059            my @removedPaths =
     1060              ( sort { length $a > length $b } keys %removedfiles );
    10801061            print join( "\n", @removedPaths ) . "\n\n";
    10811062
     
    10831064            # and also create directories
    10841065            # paths are sorted, so that directories are created first
    1085             for my $real_path ( @removedPaths ) {
    1086                 if( -d $removedfiles{"$real_path"} ) {
     1066            for my $real_path (@removedPaths) {
     1067                if ( -d $removedfiles{"$real_path"} ) {
    10871068                    mkpath("$real_path");
    10881069                } else {
    1089                     copy( $removedfiles{"$real_path"}, $real_path ) or error( "failed to copy " .  $removedfiles{"$real_path"} . " to " . $real_path . ": " . $! );
     1070                    copy( $removedfiles{"$real_path"}, $real_path )
     1071                      or error( "failed to copy "
     1072                          . $removedfiles{"$real_path"} . " to "
     1073                          . $real_path . ": "
     1074                          . $! );
    10901075                }
    10911076            }
     
    11161101    return $return_code;
    11171102}
    1118 
    1119 
    11201103
    11211104sub blame(@)
     
    11301113        my $filename_prod,
    11311114        my $filename_repo
    1132       )
    1133       = get_filenames( $_[0] );
     1115    ) = get_filenames( $_[0] );
    11341116
    11351117    my $retcode = run_interactive("$SVN blame $svnOptions $filename_repo");
     
    11471129        my $filename_prod,
    11481130        my $filename_repo
    1149       )
    1150       = get_filenames( $_[0] );
     1131    ) = get_filenames( $_[0] );
    11511132
    11521133    #print "$basename,$dirname_prod,$dirname_repo\n";
     
    11711152        my $filename_prod,
    11721153        my $filename_repo
    1173       )
    1174       = get_filenames( $_[0] || "/" );
     1154    ) = get_filenames( $_[0] || "/" );
    11751155
    11761156    # return code for the shell
     
    14131393        commit(@ARGV);
    14141394    } elsif (m/^revert$/i) {
    1415         $command = "revert";
     1395        $command     = "revert";
    14161396        $return_code = revert(@ARGV);
    14171397    } elsif (m/^blame$/i) {
Note: See TracChangeset for help on using the changeset viewer.