Changeset 233 for trunk


Ignore:
Timestamp:
Oct 8, 2008, 3:45:21 PM (16 years ago)
Author:
joergs
Message:

better check file types. Don't try to checkin directories, because they fail. Offer checkin of multiple files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dasscm/dasscm

    r228 r233  
    8181}
    8282
     83sub warning(@)
     84{
     85    print "Warning: " . join( "\n         ", @_ ) . "\n";
     86}
     87
     88sub error(@)
     89{
     90    print "Error:   " . join( "\n         ", @_ ) . "\n";
     91}
     92
     93sub fatalerror(@)
     94{
     95    error( @_ );
     96    #print "Exiting\n";
     97    exit 1
     98}
     99
    83100sub check_env()
    84101{
     
    156173sub check_parameter(@)
    157174{
     175    if( not @_ ) {
     176        fatalerror( "no files specified. See 'dasscm --help'" );
     177    }
    158178}
    159179
     
    165185    }
    166186
    167     -r $filename_prod or die "$filename_prod is not accessable";
     187    if( not -r $filename_prod ) {
     188        fatalerror( $filename_prod  . " is not accessable" );
     189    } elsif( -l $filename_prod ) {
     190        my $dest = readlink($filename_prod);
     191        # TODO:
     192        #   default: disallow, but offer cmd switch to activate
     193        #   (or check, if file is already checked in and has been a link before)
     194        warning( "'$filename_prod' is a link to '$dest'.", "Please check, if '$dest' should be stored in repository instead" );
     195        if( ! -f $dest ) {
     196            fatalerror( "link target '$dest' is not a regular file. Giving up" );
     197        }
     198    } elsif( ! -f $filename_prod ) {
     199        fatalerror( $filename_prod . " is not a regular file. Only regular files can be checked in." );
     200    }
    168201
    169202    # TODO: dirname buggy: eg. "/etc/" is reduced to "/",
     
    480513    svn_update();
    481514
    482     # add file
    483     add_helper( $_[0] );
     515    # TODO: check all files
     516
     517    for my $file (@_) {
     518        # add file
     519        add_helper( $file );
     520    }
    484521
    485522    # create new permissions file
Note: See TracChangeset for help on using the changeset viewer.