Ignore:
Timestamp:
11/11/2009 14:27:08 (3 years ago)
Author:
ccowart
Message:

Merging rename and sed cleanups from trunk.

Resolves #97, #98

Location:
branches/confman-1.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/confman-1.9

  • branches/confman-1.9/confmanlib.sh.in

    r485 r487  
    839839 
    840840function conf_rename { 
    841         local oldmod=$1 
    842         local newmod=$2 
    843         local file 
    844  
    845         # First, we perform the easy operations 
    846         @SVN@ mv ${WORK_PATH}/${oldmod} ${WORK_PATH}/${newmod} || \ 
    847                 {       echo "There was a problem renaming the modules." >&4 ; \ 
    848                         conf_cleanExit 1  
    849                 } 
    850         @SVN@ mv ${WORK_PATH}/${REPO_CHECKPTS}/${oldmod} \ 
    851                         ${WORK_PATH}/${REPO_CHECKPTS}/${newmod} || \ 
    852                 {       echo "There was a problem renaming the checkpts." >&4 ; \ 
    853                         conf_cleanExit 1  
    854                 } 
    855  
    856         @SVN@ update ${WORK_PATH} || \ 
    857                 {       echo "Your working copy didn't update correctly." >&4 ; \ 
    858                         conf_cleanExit 1  
    859                 } 
    860         @SVN@ commit -m "Renaming ${oldmod} to ${newmod}, phase 1." \ 
    861                 ${WORK_PATH}/{,${REPO_CHECKPTS}}/{${oldmod},${newmod}} || \ 
    862                 {       echo "Committing the changes failed." >&4 ; conf_cleanExit 1  
    863                 } 
    864  
    865         # Next, we have to rename any singularities 
    866         for file in ${SINGULARITIES} ; do 
    867                 if [ -f "${WORK_PATH}/${newmod}${file}-${oldmod}" ] ; then 
    868                         @SVN@ mv ${WORK_PATH}/${newmod}${file}-${oldmod} \ 
    869                                         ${WORK_PATH}/${newmod}${file}-${newmod} 
    870                 fi 
    871         done 
    872  
    873         @SVN@ update ${WORK_PATH} || \ 
    874                 {       echo "Your working copy didn't update correctly." >&4 ; \ 
    875                         conf_cleanExit 1  
    876                 } 
    877         @SVN@ commit -m "Renaming ${oldmod} to ${newmod}, phase 2." \ 
    878                 ${WORK_PATH}/${newmod} || \ 
    879                 {       echo "Committing the changes failed." >&4 ; conf_cleanExit 1  
    880                 } 
    881  
    882         # Now, we have to go fix all the confman headers in all the files... 
    883         find ${WORK_PATH}/${newmod} -type f -not -path '*/.svn/*' -exec \ 
    884                 ${sed_cmd} -i -r \ 
    885         "s/^(# Managed under )${oldmod}( module)/\1${newmod}\2/" {} \; 
    886          
    887         @SVN@ update ${WORK_PATH} || \ 
    888                 {       echo "Your working copy didn't update correctly." >&4 ; \ 
    889                         conf_cleanExit 1  
    890                 } 
    891         @SVN@ commit -m "Renaming ${oldmod} to ${newmod}, complete." \ 
    892                 ${WORK_PATH}/${newmod} || \ 
    893                 {       echo "Committing the changes failed." >&4 ; conf_cleanExit 1  
    894                 } 
     841    local oldmod=$1 
     842    local newmod=$2 
     843    local file 
     844 
     845    @SVN@ mv ${WORK_PATH}/${oldmod} ${WORK_PATH}/${newmod} || return 1 
     846    @SVN@ mv ${WORK_PATH}/${REPO_CHECKPTS}/${oldmod} \ 
     847        ${WORK_PATH}/${REPO_CHECKPTS}/${newmod} || return 1 
     848 
     849    for file in ${SINGULARITIES} ; do 
     850        if [ -f ${WORK_PATH}/${newmod}${file}-${oldmod} ]; then 
     851            @SVN@ mv ${WORK_PATH}/${newmod}${file}-${oldmod} \ 
     852                ${WORK_PATH}/${newmod}${file}-${newmod} || return 1 
     853        fi 
     854    done 
     855 
     856    find ${WORK_PATH}/${newmod} -type f -not -path '*/.svn/*' -exec \ 
     857        ${sed_cmd} -i"" \ 
     858        "s/(Managed under )${oldmod}( module\.)$/\1${newmod}\2/" {} \; \ 
     859        || return 1 
     860 
     861    @SVN@ commit -m "Renaming ${oldmod} to ${newmod}" \ 
     862        ${WORK_PATH}/${oldmod} ${WORK_PATH}/${REPO_CHECKPTS}/${oldmod} \ 
     863        ${WORK_PATH}/${newmod} ${WORK_PATH}/${REPO_CHECKPTS}/${newmod} \ 
     864        || return 1 
     865 
     866    return 0 
    895867} 
    896868 
Note: See TracChangeset for help on using the changeset viewer.