Changeset 190 for trunk


Ignore:
Timestamp:
Nov 11, 2004, 10:55:09 AM (20 years ago)
Author:
joergs
Message:

add check for username.
bugfix: commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dasscm/dasscm

    r189 r190  
    55use strict;
    66
    7 use Env qw($DASSCM_PROD $DASSCM_REPO);
     7use Env qw($DASSCM_PROD $DASSCM_REPO $USER $DASSCM_USER $DASSCM_PW);
    88use Cwd;
    99use File::Basename;
     
    1818#
    1919my $SVN = "svn ";
     20my $subversion_options = "";
    2021
    2122#####################################################################
     
    2526sub usage()
    2627{
    27         print "dasscm is intended to help versioning configuration files\n\n";
    28        
    29         print "usage: dasscm <subcommand> [options] [args]\n\n";
     28        print "usage: dasscm <subcommand> [options] [args]\n";
     29        print "\n";
     30        print "dasscm is intended to help versioning configuration files\n";
     31        print "\n";     
    3032        print "Available subcommands:\n";
    3133        print "   add <filename>\n";
     
    3335        print "   diff <filename>\n";
    3436        print "   help <subcommand>\n";
     37        print "\n";     
     38        print "preperation:\n";
     39        print "check out the configuration repository, e.g.\n";
     40        print "svn checkout --no-auth-cache --username $USER https://dass-it.de/svn/lvermgeo/technical/config/\n";
     41        print "environment variables DASSCM_REPO, DASSCM_PROD and DASSCM_USER are evaluated.\n";
     42        print "\n";
    3543}
    3644
     
    4856        # DASSCM_REPO
    4957        if ( ! $DASSCM_REPO ) {
    50                 die "Envirnonment variable DASSCM_REPO not set.\nSet DASSCM_REPO to the directory of the versioning system checkout for this machine.";
     58                die "Envirnonment variable DASSCM_REPO not set.\nSet DASSCM_REPO to the directory of the versioning system checkout for this machine.\n";
    5159        }
    5260        print "DASSCM_REPO: ".$DASSCM_REPO."\n";
     
    5563        }
    5664       
     65        # User settings
     66        # user root is not allowed for checkins.
     67        # if user is root, DASSCM_USER has to be set,
     68        # otherwise USER can be used
     69        if ( "$USER" eq "root" ) {
     70                if ( ! $DASSCM_USER ) {
     71                        die "Envirnonment variable DASSCM_USER not set.\nSet DASSCM_USER to your subversion user account.\n";
     72                }
     73                $subversion_options .= " --no-auth-cache "
     74        } elsif ( ! $DASSCM_USER ) {
     75                $DASSCM_USER=$USER;
     76        }       
    5777}
    5878
     
    147167
    148168        # commit calls $EDITOR. uses "system" here, to display output
    149         system( "$SVN commit $DASSCM_REPO" );
     169        system( "$SVN commit --username $DASSCM_USER $subversion_options $DASSCM_REPO" );
    150170        # TODO: commit (-m)
    151171
     
    166186                die;
    167187        }
     188       
     189        copy( $filename_prod, $filename_repo ) or die $!;
    168190
    169191        # commit calls $EDITOR. uses "system" here, to display output
    170         system( "$SVN commit $DASSCM_REPO" );
     192        system( "$SVN commit --username $DASSCM_USER $subversion_options $DASSCM_REPO" );
    171193        # TODO: commit (-m)
    172194}
Note: See TracChangeset for help on using the changeset viewer.