Changeset 28069 for other-projects/nightly-tasks/diffcol/trunk
- Timestamp:
- 2013-08-15T20:28:00+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh
r28049 r28069 72 72 # http://stackoverflow.com/questions/1301203/removing-svn-files-from-all-directories 73 73 74 #*******************************GLOBAL VARIABLES*************************** 75 76 # mode can be svndelete or svnupdate 77 mode= 78 debug_mode=0 79 commit_message= 80 81 #*****************************FUNCTIONS***************************** 74 82 75 83 # DON'T ADD ANY FURTHER ECHO STATEMENTS IN FUNCTION get_col_basename … … 113 121 fi 114 122 115 # commit all the svn rm statements done above in one go: 116 # don't do `svn up` here, as this will then retrieve all the folders that were svn-removed 117 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Clean rebuild of model collections 1/2. Clearing out deprecated archives and index." model-collect 118 119 # do an svn up to locally delete what was svn-removed above, BEFORE copying from the rebuilt archives and index folders 120 svn up model-collect 121 123 # svn commit all the svn rm statements done above in one go: 124 # don't do `svn up` at this point, as doing so will then retrieve all the folders that just were svn-removed 125 126 if [ "x$commit_message" == "x" ]; then 127 commit_message="Clean rebuild of model collections 1/2. Clearing out deprecated archives and index." 128 fi 129 130 # Numerical comparisons: http://tldp.org/LDP/abs/html/comparison-ops.html 131 if [ "$debug_mode" -eq "0" ]; then 132 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Message: $commit_message" model-collect 133 fi 134 135 # Having svn committed the deletes, do an svn up to locally delete what was svn-removed above, 136 # BEFORE copying from the rebuilt archives and index folders 137 if [ "$debug_mode" -eq "0" ]; then 138 svn up model-collect 139 fi 140 141 # copy from the rebuilt archives and index over into the svn model-collect and svn add them 122 142 if [ "x$1" == "x" ]; then 123 143 for collection in collect/*; do … … 131 151 132 152 # commit all the svn add statements done just above in one go 133 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Clean rebuild of model collections 2/2. Adding rebuilt archives and index." model-collect 153 if [ "x$commit_message" == "x" ]; then 154 commit_message="Clean rebuild of model collections 2/2. Adding rebuilt archives and index." 155 fi 156 157 if [ "$debug_mode" -eq "0" ]; then 158 svn commit -m "AUTOCOMMIT by gen-model-colls.sh script. Message: $commit_message" model-collect 159 fi 134 160 135 161 echo … … 159 185 160 186 # remove the entire archives and index folders from svn 161 svn rm model-collect/$collection/archives 162 svn rm model-collect/$collection/index 163 164 # for TESTING purposes: 165 # rm -rf model-collect/$collection/archives 166 # rm -rf model-collect/$collection/index 187 if [ "$debug_mode" -eq "0" ]; then 188 svn rm model-collect/$collection/archives 189 svn rm model-collect/$collection/index 190 elif [ "$debug_mode" -eq "1" ]; then 191 rm -rf model-collect/$collection/archives 192 rm -rf model-collect/$collection/index 193 fi 167 194 168 195 } … … 184 211 cp -r collect/$collection/archives model-collect/$collection/. 185 212 cp -r collect/$collection/index model-collect/$collection/. 186 187 svn add model-collect/$collection/archives 188 svn add model-collect/$collection/index 213 214 if [ "$debug_mode" -eq "0" ]; then 215 svn add model-collect/$collection/archives 216 svn add model-collect/$collection/index 217 fi 189 218 } 190 219 … … 252 281 cp -r collect/$collection/index/* model-collect/$collection/index/. 253 282 283 # now svn add any and all the NEW items in model-collect's archives and index 284 # see http://stackoverflow.com/questions/1071857/how-do-i-svn-add-all-unversioned-files-to-svn 285 # if [ "$debug_mode" -eq "0" ]; then 286 svn add --force model-collect/$collection/archives/* --auto-props --parents --depth infinity -q 287 svn add --force model-collect/$collection/index/* --auto-props --parents --depth infinity -q 288 # fi 289 254 290 echo "svn model-collect update process complete. CHECK AND COMMIT THE model-collect FOLDER!" 255 291 … … 296 332 297 333 298 # The program starts here334 #*******************************MAIN PROGRAM*************************** 299 335 300 336 # process optional command line arguments 301 337 # http://blog.onetechnical.com/2012/07/16/bash-getopt-versus-getopts/ 302 338 # Execute getopt 303 ARGS=$(getopt -o ud -l "svnupdate,svndelete" -n "$0" -- "$@");339 ARGS=$(getopt -o m:uxd -l "message:,svnupdate,svndelete,debug" -n "$0" -- "$@"); 304 340 305 341 #Bad arguments … … 311 347 eval set -- "$ARGS"; 312 348 313 # mode can be svndelete or svnupdate314 mode=315 349 316 350 # -n: http://tldp.org/LDP/abs/html/testconstructs.html 317 351 while true; do 318 352 case "$1" in 319 - d|--svndelete)353 -x|--svndelete) 320 354 shift; 321 355 if [ "x$mode" == "xsvnupdate" ]; then … … 339 373 fi 340 374 ;; 375 -d|--debug) 376 shift; 377 debug_mode=1 378 ;; 379 -m|--message) 380 shift; 381 if [ -n "$1" ]; then 382 commit_message=$1 383 shift; 384 fi 385 ;; 341 386 --) 342 387 shift; … … 345 390 esac 346 391 done 392 393 #echo "commit message: $commit_message" 394 #echo "Debug mode is: $debug_mode" 395 #exit 347 396 348 397 # If no mode provided (svndelete|svnupdate) as cmd line arg, then don't modify … … 390 439 else 391 440 for collection in "$@"; do 392 if [ -e model-collect/$collection ]; then 393 svn up model-collect/$collection 394 else 395 svn up model-collect 396 fi 441 svn up model-collect/$collection 397 442 done 398 443 fi … … 512 557 echo "* DIFFERENCES REMAINING BETWEEN model-collect AND collect (skipping .svn folders):" 513 558 echo 514 echo "---START DIFF---" 515 diff -rq model-collect collect | grep -v ".svn" 559 if [ "$1" == "" ]; then 560 echo "---START DIFF---" 561 diff -rq model-collect collect | grep -v ".svn" 562 else 563 for collection in "$@"; do 564 echo "--COLLECTION: $collection" 565 diff -rq model-collect/$collection collect/$collection | grep -v ".svn" 566 echo "--" 567 done 568 fi 516 569 echo "---END DIFF---" 517 570 echo … … 519 572 520 573 echo "* The original collect directory has been left renamed as collect_orig" 574 echo 575 576 if [ "$debug_mode" -eq "1" ]; then 577 echo "* This script was run in DEBUG MODE, nothing has been changed in svn" 578 fi 521 579 echo 522 580 echo "*****************************************"
Note:
See TracChangeset
for help on using the changeset viewer.