Changeset 891 for dasscm/trunk


Ignore:
Timestamp:
Jun 26, 2010, 12:57:52 PM (14 years ago)
Author:
joergs
Message:

cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dasscm/trunk/usr/bin/dasscm

    r890 r891  
    1111use File::Basename;
    1212use File::Compare;
    13 
    14 # used system("cp -a"), because File::Copy does not keep permissions
    15 #use File::Copy;
     13## used system("cp -a"), because File::Copy does not keep permissions
     14##use File::Copy;
    1615use File::Find;
    1716use File::stat;
     
    7069#           CMD
    7170#           USER
    72 #           PATH
    73 #           REPOPATH
     71#           PATH_PROD
     72#           PATH_REPO
    7473# require:
    7574#           WRITE commands that require write access (and therefore a login)
     
    9594    'ls' => {
    9695        'desc'     => [],
    97         'params'   => ["REPOPATH"],
     96        'params'   => ["PATH_REPO"],
    9897        'function' => \&ls
    9998    },
    10099    'update' => {
    101100        'desc'     => [],
    102         'params'   => ["PATH"],
     101        'params'   => ["PATH_REPO"],
    103102        'function' => \&update
    104103    },
    105104    'add' => {
    106105        'desc'     => [],
    107         'params'   => ["PATH"],
     106        'params'   => ["PATH_PROD"],
    108107        'require'  => ["WRITE"],
    109108        'function' => \&add
     
    111110    'commit' => {
    112111        'desc'     => [],
    113         'params'   => ["REPOPATH"],
     112        'params'   => ["PATH_REPO"],
    114113        'require'  => ["WRITE"],
    115114        'function' => \&commit
     
    117116    'revert' => {
    118117        'desc'     => ["revert local changes back to version from repository"],
    119         'params'   => ["REPOPATH"],
     118        'params'   => ["PATH_REPO"],
    120119        'function' => \&revert
    121120    },
    122121    'blame' => {
    123         'desc'     => [],
    124         'params'   => ["PATH"],
     122        'desc' => [],
     123        ## TODO: only files from PATH_REPO
     124        'params'   => ["PATH_REPO"],
    125125        'function' => \&blame
    126126    },
    127127    'diff' => {
    128128        'desc'     => [],
    129         'params'   => ["PATH"],
     129        'params'   => ["PATH_REPO"],
    130130        'function' => \&diff
    131131    },
    132132    'status' => {
    133133        'desc'     => [],
    134         'params'   => ["PATH"],
     134        'params'   => ["PATH_REPO"],
    135135        'function' => \&status
    136136    },
     
    969969    my @files = glob($path);
    970970
    971     # if only one result is available
    972     # and this result is a directory,
    973     # add another result entry
    974     # (otherwise complete will stop here and continue with the next parameter)
    975971    if ( $#files == 0 ) {
    976         my $path = $files[0];
     972
     973        # if only one result is available
     974        # and this result is a directory,
     975        # add another result entry
     976        # (directory with and withour trainling /),
     977        # otherwise complete will stop here and continue with the next parameter
     978        my $path = normalize_path( $files[0] );
    977979        if ( -d $path ) {
    978             push( @files, $path . "/" );
     980            @files = ( substr( $path, 0, -1 ), $path );
    979981        }
    980982    } else {
     983
    981984        # add "/" to all directories
    982         @files = map( { -d $_ && $_ ."/" || $_ } @files );
     985        @files = map( { normalize_path($_) } @files );
    983986    }
    984987
     
    15661569            $_ = $i;
    15671570            if (m/^$input/) {
    1568                 my $command = get_command_uniform_name($i);
    1569                 print $command, "\n";
     1571
     1572                #my $command = get_command_uniform_name($i);
     1573                #print $command, "\n";
     1574                print $i, "\n";
    15701575            }
    15711576        }
     
    15761581        my @params  = get_command_possible_params( $input[0] );
    15771582        if ($verbose) { print "params: ", Dumper(@params); }
    1578         if ( defined( $params[ $number_arguments - 2 ] )
    1579             && $params[ $number_arguments - 2 ] )
     1583
     1584        # arg 1:    dasscm
     1585        # arg 2:    command
     1586        # arg 3-x:  parameter, therefore parameter_number = $number_arguments - 2
     1587        my $parameter_number = $number_arguments - 2;
     1588        if ( defined( $params[$parameter_number] )
     1589            && $params[$parameter_number] )
    15801590        {
    1581             my $param = $params[ $number_arguments - 2 ];
    1582             if ( $param eq "PATH" ) {
     1591            my $param = $params[$parameter_number];
     1592            if ($verbose) { print "param used: ", $param, "\n"; }
     1593            if ( $param eq "PATH_PROD" ) {
    15831594                complete_path( $input[ $number_arguments - 1 ] );
    1584             } elsif ( $param eq "REPOPATH" ) {
     1595            } elsif ( $param eq "PATH_REPO" ) {
    15851596                complete_repopath( $input[ $number_arguments - 1 ] );
    1586             } else {
    1587                 print "param: $param\n";
    1588                 print Dumper($param);
    15891597            }
    15901598        }
Note: See TracChangeset for help on using the changeset viewer.