Changeset 1810 for palm/trunk
- Timestamp:
- Apr 5, 2016 8:25:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/document_changes
r1805 r1810 20 20 # Current revisions: 21 21 # ----------------- 22 # 22 # document_changes now checks all subdirectories. Modified printing to screen. 23 23 # 24 24 # Former revisions: … … 38 38 # 39 39 # Usage: 40 # a) go to the source directory (e.g. current_version/trunk /SOURCE and41 # perform"document_changes",40 # a) go to the source directory (e.g. current_version/trunk and perform: 41 # "document_changes", 42 42 # b) or call "document_changes" directly and add the path to the source code as 43 43 # argument 44 # (e.g. document_changes current_version/trunk/SOURCE)44 # (e.g. document_changes trunk) 45 45 # 46 46 # Note: … … 56 56 count_changes=0 #: count the number of files with CR text 57 57 count_files=0 #: count the number of files 58 f ilename=""#: current file name to be scanned58 fn="" #: current file name to be scanned 59 59 file_firstchar="" #: first character of filename 60 60 file_lastchar="" #: last character of filename … … 66 66 line_count=0 #: counter to the line no. of the file 67 67 line_start=9999999 #: line no. where CR text starts 68 line_stop=0 #: line no. where C rtext ends68 line_stop=0 #: line no. where CR text ends 69 69 line_tmp="" #: first 19 characters of line 70 70 list_delete="" #: contains the line no. that must be deleted from CR … … 78 78 input_dir=`pwd` 79 79 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 83 93 84 94 # 85 95 #-- exclude backup and invisible files 86 file_firstchar=${f ilename:0:1}87 file_lastchar=`echo -n $f ilename| tail -c -1`88 file_extension=${f ilename##*.}96 file_firstchar=${fn:0:1} 97 file_lastchar=`echo -n $fn| tail -c -1` 98 file_extension=${fn##*.} 89 99 if [[ "$file_firstchar" == "." || "$file_extension" == "x" || "$file_lastchar" == "~" || "$file_extension" == "tar" ]] 90 100 then 91 101 continue 92 102 fi 93 103 94 104 (( count_files = count_files + 1 )) 95 105 … … 135 145 if [[ $line_count -eq $line_start && "$line_no_space" != "" ]] 136 146 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 138 152 found_comment=true 139 cp $f ilename $filename~153 cp $fn $fn~ 140 154 fi 141 155 … … 148 162 fi 149 163 fi 150 164 151 165 # 152 166 #-- get the timestamp from the current revision … … 157 171 fi 158 172 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 161 178 # 162 179 #-- move comments from current revisions to former revisions … … 169 186 #-- insert comments to Former Revisions 170 187 (( line_stop = line_stop + 4 )) 171 sed -i "${line_stop}i$comments" $f ilename188 sed -i "${line_stop}i$comments" $fn 172 189 173 190 # 174 191 #-- delete comments from current revisions and insert two blank lines 175 192 list_delete=${list_delete#?} 176 sed -i "$list_delete" $f ilename177 sed -i "${line_start}i${comment_char} " $f ilename178 sed -i "${line_start}i${comment_char} " $f ilename193 sed -i "$list_delete" $fn 194 sed -i "${line_start}i${comment_char} " $fn 195 sed -i "${line_start}i${comment_char} " $fn 179 196 180 197 fi … … 184 201 # 185 202 #-- 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 186 206 if [[ $count_changes -gt 0 ]] 187 207 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" 196 210 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 199 213 fi
Note: See TracChangeset
for help on using the changeset viewer.