Changeset 451 for trunk


Ignore:
Timestamp:
10/04/2009 23:15:24 (3 years ago)
Author:
blee
Message:

Implement bulk operations for confman create.

See #72

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.8.in

    r417 r451  
    150150Displays the log entires for the file or directory specified by  
    151151.Ar working_copy . 
    152 .It Cm create Ar module 
    153 A new module, named  
    154 .Ar module ,  
    155 will appear as a top-level-directory in your working copy. This change will 
    156 also be committed to the repository at the same time. 
     152.It Cm create Ar module [ Ar module Ar ... ] 
     153Creates one or more modules for the 
     154.Ar module 
     155arguments provided.  New modules will appear in the top-level-directory of 
     156your working copy.  This change will also be committed to the repository 
     157at the same time. 
    157158.It Cm rmmod Ar module 
    158159Delete the specified  
  • trunk/confman.in

    r443 r451  
    9090    else 
    9191        conf_lock_wcopy 
    92         local module=$1 
    93         conf_create_module $module || exit 1 
     92        conf_create_modules "$@" || exit 1 
    9493        conf_unlock_wcopy 
    9594    fi 
  • trunk/confmandoc.sh

    r447 r451  
    4141  $MYNAME audit 
    4242  $MYNAME log [ working_copy ] 
    43   $MYNAME create module 
     43  $MYNAME create module [ module ... ] 
    4444  $MYNAME rmmod module 
    4545  $MYNAME rename oldmodule newmodule 
     
    100100 
    101101Usage: 
    102   $MYNAME create module 
    103  
    104 The create command will cause a new module, named module, to appear as a 
    105 top-level-directory in your working copy. This change will also be made to 
    106 the repositry at the same time.  
     102  $MYNAME create module [ module ... ] 
     103 
     104Creates one or more modules for the module arguments provided. 
     105New modules will appear in the top-level-directory of your work- 
     106ing copy.  This change will also be committed to the repository 
     107at the same time. 
    107108 
    108109EOF 
  • trunk/confmanlib.sh.in

    r449 r451  
    165165} 
    166166 
     167function conf_create_modules { 
     168    local module 
     169    local newmodules 
     170    local rc=0 
     171 
     172    for module in "$@"; do 
     173        if conf_create_module "$module"; then 
     174            # Keep track of the modules that were successfully created 
     175            # avoid inadvertently committing outstanding changes to 
     176            # pre-existing modules 
     177            if [ -z "$newmodules" ]; then 
     178                newmodules="$module" 
     179            else 
     180                newmodules="$newmodules,$module" 
     181            fi 
     182        else 
     183            rc=1 
     184        fi 
     185    done 
     186 
     187    # $newmodules is in the form foo,bar,baz. This eval trick forces 
     188    # curly brace expansion. 
     189    if echo "$newmodules" | grep -q ','; then 
     190        @SVN@ commit $(eval echo ${WORK_PATH}/{$newmodules}) \ 
     191            $(eval echo ${WORK_PATH}/${REPO_CHECKPTS}/{$newmodules}) -m \ 
     192            "Created directory structure for $newmodules --`whoami`" 
     193    elif [ -n "$newmodules" ]; then 
     194        # We test -n for this case because $newmodules might 
     195        # be empty, i.e. no new modules were created 
     196        @SVN@ commit ${WORK_PATH}/$newmodules \ 
     197            ${WORK_PATH}/${REPO_CHECKPTS}/$newmodules -m \ 
     198            "Created directory structure for $newmodules --`whoami`" 
     199    fi 
     200 
     201    return $rc 
     202} 
     203 
    167204# Assumes that we already have core setup in our work path. 
    168205function conf_create_module { 
     
    177214    @SVN@ mkdir ${WORK_PATH}/$module 
    178215    @SVN@ mkdir ${WORK_PATH}/${REPO_CHECKPTS}/$module 
    179     @SVN@ commit ${WORK_PATH}/${module} \ 
    180         ${WORK_PATH}/${REPO_CHECKPTS}/$module -m \ 
    181         "Created directory structure for ${module} --`whoami`" 
    182216 
    183217    return 0 
Note: See TracChangeset for help on using the changeset viewer.