Changeset 914 for dasscm/trunk/usr/bin
- Timestamp:
- Jul 2, 2010, 5:16:50 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dasscm/trunk/usr/bin/dasscm
r907 r914 76 76 my %COMMAND_DEFINITIONS = ( 77 77 'help' => { 78 'desc' => [ ],78 'desc' => ["print help and usage information"], 79 79 'params' => ["CMD"], 80 80 'function' => \&help, 81 81 }, 82 82 'login' => { 83 'desc' => [ ],83 'desc' => ["user login to Subversion repositoty"], 84 84 'params' => ["USER"], 85 85 'function' => \&login … … 94 94 }, 95 95 'ls' => { 96 'desc' => [ ],96 'desc' => ["list file from repository"], 97 97 'params' => ["PATH_REPO"], 98 98 'function' => \&ls 99 99 }, 100 100 'update' => { 101 'desc' => [], 101 'desc' => [ 102 "update local repository checkout", 103 "Normally, this is done automatically" 104 ], 102 105 'params' => ["PATH_REPO"], 103 106 'function' => \&update 104 107 }, 105 108 'add' => { 106 'desc' => [], 109 'desc' => [ 110 "add a file to the subversion repository", 111 "Unlike the native svn command,", 112 "dasscm adds and immediatly submits a file to the subversion repository" 113 ], 107 114 'params' => ["PATH_PROD"], 108 115 'options' => [ 'verbose', 'message=s' ], … … 111 118 }, 112 119 'commit' => { 113 'desc' => [],120 'desc' => ["commit a changed file to the subversion repository"], 114 121 ## TODO: only modified files 115 122 'params' => ["PATH_REPO"], … … 119 126 }, 120 127 'revert' => { 121 'desc' => ["revert local changes back to version from repository"], 128 'desc' => [ 129 "revert local changes back to version from the repository (see diff)" 130 ], 122 131 'params' => ["PATH_REPO"], 123 132 'function' => \&revert 124 133 }, 125 134 'blame' => { 126 'desc' => [ ],135 'desc' => ['like "svn blame"'], 127 136 ## TODO: only files from PATH_REPO 128 137 'params' => ["PATH_REPO"], … … 130 139 }, 131 140 'diff' => { 132 'desc' => [], 141 'desc' => [ 142 'display the differences between files on the system and the repository' 143 ], 133 144 'params' => ["PATH_REPO"], 134 145 'function' => \&diff 135 146 }, 136 147 'status' => { 137 'desc' => [], 148 'desc' => [ 149 'display status information about modified and deleted files.', 150 'If no path is given "/" is assumed', 151 '(in contract to "svn" with assumes ".")' 152 ], 138 153 'params' => ["PATH_REPO"], 139 154 'function' => \&status … … 145 160 }, 146 161 'permissions' => { 147 'desc' => [], 162 'desc' => 163 ["internal, used to update information about file permissions"], 148 164 'params' => [], 149 165 'function' => \&permissions 150 166 }, 151 167 'cleanup' => { 152 'desc' => [ ],168 'desc' => ["internal, used to clean repository checkout"], 153 169 'params' => [], 154 170 'function' => \&cleanup 155 171 }, 156 172 'complete' => { 157 'desc' => ["internal ly, used for bash completion"],173 'desc' => ["internal, used for bash completion"], 158 174 'params' => ["CMD"], 159 175 'function' => \&complete 160 176 }, 161 177 'complete_path' => { 162 'desc' => ["internal ly, used for bash completion"],178 'desc' => ["internal, used for bash completion"], 163 179 'params' => [], 164 180 'function' => \&complete_path 165 181 }, 166 182 'complete_repopath' => { 167 'desc' => ["internal ly, used for bash completion"],183 'desc' => ["internal, used for bash completion"], 168 184 'params' => [], 169 185 'function' => \&complete_repopath … … 1576 1592 # check and remove global options. if options are wrong, nothing to do 1577 1593 @ARGV = @input; 1578 if ( GetOptions( \%options_complete, @OPTIONS_GLOBAL ) ) {1594 if ( GetOptions( \%options_complete, @OPTIONS_GLOBAL ) ) { 1579 1595 my $number_arguments = @input; 1580 1596 if ( $number_arguments <= 1 ) { … … 1584 1600 map { m/^$input/ && print $_, "\n" } ( keys %COMMANDS ); 1585 1601 } else { 1602 1586 1603 # complete dasscm parameter 1587 1604 my $command = get_command_uniform_name( $input[0] ); 1588 if( $command ) { 1605 if ($command) { 1606 1589 1607 # remove command 1590 1608 shift @input; 1591 1609 1592 1610 # check and remove options 1593 my @options = get_command_possible_options( $command);1611 my @options = get_command_possible_options($command); 1594 1612 @ARGV = @input; 1595 if( ( not @options ) || ( GetOptions( \%options_complete, @options ) ) ) { 1596 1597 my @params = get_command_possible_params( $command ); 1613 if ( ( not @options ) 1614 || ( GetOptions( \%options_complete, @options ) ) ) 1615 { 1616 1617 my @params = get_command_possible_params($command); 1598 1618 if ($verbose) { print "params: ", Dumper(@params); } 1599 1619 … … 1602 1622 #print "input: ", join( ",", @input ), " (", $number_arguments, ")\n"; 1603 1623 1604 if ( $number_arguments > 0 ) {1624 if ( $number_arguments > 0 ) { 1605 1625 my $parameter_number = $number_arguments - 1; 1606 1626 if ( defined( $params[$parameter_number] ) … … 1608 1628 { 1609 1629 my $param = $params[$parameter_number]; 1610 if ($verbose) { print "param used: ", $param, "\n"; } 1630 if ($verbose) { 1631 print "param used: ", $param, "\n"; 1632 } 1611 1633 if ( $param eq "PATH_PROD" ) { 1612 complete_path( $input[ $number_arguments - 1 ] ); 1634 complete_path( 1635 $input[ $number_arguments - 1 ] ); 1613 1636 } elsif ( $param eq "PATH_REPO" ) { 1614 complete_repopath( $input[ $number_arguments - 1 ] ); 1637 complete_repopath( 1638 $input[ $number_arguments - 1 ] ); 1615 1639 } 1616 1640 } … … 1683 1707 # global options 1684 1708 # stops at first non-option 1685 Getopt::Long::Configure( 'require_order');1686 if ( not GetOptions( \%options, @OPTIONS_GLOBAL ) ) {1709 Getopt::Long::Configure('require_order'); 1710 if ( not GetOptions( \%options, @OPTIONS_GLOBAL ) ) { 1687 1711 usage(); 1688 1712 exit $RETURN_NOK; … … 1692 1716 $verbose = $options{'verbose'}; 1693 1717 1694 if ( $options{'help'} ) {1718 if ( $options{'help'} ) { 1695 1719 help(@ARGV); 1696 1720 exit; … … 1698 1722 1699 1723 # get subcommand and remove it from @ARGV 1700 if ( defined( $ARGV[0] ) ) {1724 if ( defined( $ARGV[0] ) ) { 1701 1725 $command = get_command_uniform_name( $ARGV[0] ); 1702 1726 shift @ARGV; 1703 1727 } 1704 1728 1705 if ( not defined($command) ) {1706 1707 1729 if ( not defined($command) ) { 1730 usage(); 1731 exit $RETURN_NOK; 1708 1732 } 1709 1733 … … 1713 1737 # TODO: check variables 1714 1738 $DASSCM_SVN_REPOSITORY = 1715 1739 $config->{'DASSCM_SVN_REPOSITORY_BASE'} . "/" . $DASSCM_REPOSITORY_NAME; 1716 1740 1717 1741 $DASSCM_CHECKOUT_USERNAME = $config->{'DASSCM_CHECKOUT_USERNAME'}; … … 1728 1752 if ( $DASSCM_CHECKOUT_USERNAME && $DASSCM_CHECKOUT_PASSWORD ) { 1729 1753 $svnCheckoutCredentials = 1730 1754 " --username $DASSCM_CHECKOUT_USERNAME --password $DASSCM_CHECKOUT_PASSWORD "; 1731 1755 } 1732 1756 1733 1757 $DASSCM_PERMISSION_FILE = $config->{'DASSCM_PERMISSION_FILE'} 1734 1758 || "/etc/permissions.d/dasscm.permission_backup"; 1735 1759 1736 1760 # check for command options 1737 my @cmd_options = get_command_possible_options( $command ); 1738 if( @cmd_options ) { 1761 my @cmd_options = get_command_possible_options($command); 1762 if (@cmd_options) { 1763 1739 1764 # get command line options and store them in options hash 1740 1765 my $result = GetOptions( \%options, @cmd_options );
Note:
See TracChangeset
for help on using the changeset viewer.