Ignore:
Timestamp:
Apr 5, 2016 8:25:29 PM (6 years ago)
Author:
maronga
Message:

update of document_changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/document_changes

    r1805 r1810  
    2020# Current revisions:
    2121# -----------------
    22 #
     22# document_changes now checks all subdirectories. Modified printing to screen.
    2323#
    2424# Former revisions:
     
    3838#
    3939# Usage:
    40 # a) go to the source directory (e.g. current_version/trunk/SOURCE and
    41 #    perform "document_changes",
     40# a) go to the source directory (e.g. current_version/trunk and perform:
     41#    "document_changes",
    4242# b) or call "document_changes" directly and add the path to the source code as
    4343#    argument
    44 #    (e.g. document_changes current_version/trunk/SOURCE)
     44#    (e.g. document_changes trunk)
    4545#
    4646# Note:
     
    5656    count_changes=0     #: count the number of files with CR text
    5757    count_files=0       #: count the number of files
    58     filename=""         #: current file name to be scanned
     58    fn=""               #: current file name to be scanned
    5959    file_firstchar=""   #: first character of filename
    6060    file_lastchar=""    #: last character of filename
     
    6666    line_count=0        #: counter to the line no. of the file
    6767    line_start=9999999  #: line no. where CR text starts
    68     line_stop=0         #: line no. where Cr text ends
     68    line_stop=0         #: line no. where CR text ends
    6969    line_tmp=""         #: first 19 characters of line
    7070    list_delete=""      #: contains the line no. that must be deleted from CR
     
    7878       input_dir=`pwd`
    7979    fi
    80     printf "\n  *** Checking files in $input_dir\n"
    81 
    82     for filename in $input_dir/*; do
     80   
     81    printf "\n"
     82    printf "#------------------------------------------------------------------------# \n"
     83    printf "| \e[1mdocument_changes\e[0m                                                       | \n"
     84    printf "|                                                                        | \n"
     85    printf "| This tool moves the change comments in the all PALM file headers from  | \n"
     86    printf "| 'Current revisions' to 'Former revisions' and saves the time stamp.    | \n" 
     87    printf "#------------------------------------------------------------------------# \n"
     88   
     89    printf "\n  *** Checking files in $input_dir and all recursive subdirectories...\n"
     90
     91    IFS=$'\n';
     92    for fn in $(find $input_dir -not -name '*.pdf' -and -not -name '*.x' -and -not -name '*.eps' -and -not -name '*.png' -and -not -name '*.svn*'); do
    8393
    8494#
    8595#--    exclude backup and invisible files
    86        file_firstchar=${filename:0:1}
    87        file_lastchar=`echo -n $filename| tail -c -1`
    88        file_extension=${filename##*.}
     96       file_firstchar=${fn:0:1}
     97       file_lastchar=`echo -n $fn| tail -c -1`
     98       file_extension=${fn##*.}
    8999       if [[ "$file_firstchar" == "." || "$file_extension" == "x" || "$file_lastchar" == "~" || "$file_extension" == "tar" ]]
    90100       then
    91101          continue
    92102       fi
    93 
     103       
    94104       (( count_files = count_files + 1 ))
    95105
     
    135145             if [[ $line_count -eq $line_start && "$line_no_space" != "" ]]
    136146             then
    137                 printf "\n  *** Revisions found in $filename\n"
     147
     148             
     149                printf "\r%$(tput cols)s" " "   
     150                printf "\r  \e[1;92m*** Comments found in $fn\e[0m\n"
     151             
    138152                found_comment=true
    139                 cp $filename $filename~
     153                cp $fn $fn~
    140154             fi
    141155
     
    148162             fi
    149163          fi
    150 
     164         
    151165#
    152166#--       get the timestamp from the current revision
     
    157171          fi
    158172
    159        done <"$filename"
    160 
     173       done <"$fn"
     174
     175       printf "\r%$(tput cols)s" " "   
     176       printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes\e[0m."
     177       
    161178#
    162179#--    move comments from current revisions to former revisions
     
    169186#--       insert comments to Former Revisions
    170187          (( line_stop = line_stop + 4 ))
    171           sed -i "${line_stop}i$comments" $filename
     188          sed -i "${line_stop}i$comments" $fn
    172189
    173190#
    174191#--       delete comments from current revisions and insert two blank lines
    175192          list_delete=${list_delete#?}
    176           sed -i "$list_delete" $filename
    177           sed -i "${line_start}i${comment_char} " $filename
    178           sed -i "${line_start}i${comment_char} " $filename
     193          sed -i "$list_delete" $fn
     194          sed -i "${line_start}i${comment_char} " $fn
     195          sed -i "${line_start}i${comment_char} " $fn
    179196
    180197       fi
     
    184201#
    185202#-- inform the user about the changes
     203    printf "\r%$(tput cols)s" " "
     204    printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes\e[0m. - \e[1;32mfinished.\e[0m\n\n"
     205
    186206    if  [[ $count_changes -gt 0 ]]
    187207    then
    188        printf "\n  *** $count_files documents checked.\n"
    189        printf "  *** $count_changes changed documents found.\n"
    190        printf "\n"
    191        printf "  *** All files in $input_dir were checked.\n"     
    192        printf "  *** You can now proceed with checking other directories\n"
    193        printf "      - or you might want to perform svn commit -m 'last commit documented' trunk\n"
    194        printf "\n"     
    195        printf "  *** Please do not forget to commit your changes in the changelog \n under https://palm.muk.uni-hannover.de/trac/wiki/doc/tec/changelog !"     
     208       printf "  *** You can now proceed with\n      \e[0;91msvn commit -m 'last commit documented' trunk\e[0m\n"
     209       printf "  *** Please do not forget to commit your changes in the changelog at\n      \e[0;91mhttps://palm.muk.uni-hannover.de/trac/wiki/doc/tec/changelog\e[0m!\n"   
    196210    else
    197        printf "\n  *** $count_files documents checked.\n"
    198        printf "  *** No documented modifications found.\n"
     211        printf "  *** No comments found in files!\n"   
     212   
    199213    fi
Note: See TracChangeset for help on using the changeset viewer.