Changeset 28074
- Timestamp:
- 2013-08-16T14:45:43+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh
r28073 r28074 100 100 } 101 101 102 function svn_add_new_collection () { 103 104 collection=$1 105 106 #escape the filename (in case of space) and get just the basename 107 collection=$(get_col_basename $collection) 108 109 if [ -e model-collect/$collection ];then 110 echo "svn_add_new_collection: $collection already exists in model-collect, can't add it to svn." 111 return 112 fi 113 114 find collect/$collection -name ".svn" -type d -exec rm -rf {} \; 115 cp -r collect/$collection model-collect/$collection 116 svn add model-collect/$collection 117 } 102 118 103 119 # Function that handles the --svndelete flag (mode) of this script for a single collection … … 346 362 # http://blog.onetechnical.com/2012/07/16/bash-getopt-versus-getopts/ 347 363 # Execute getopt 348 ARGS=$(getopt -o m:ux dh -l "message:,svnupdate,svndelete,debug,help" -n "$0" -- "$@");364 ARGS=$(getopt -o m:uxadh -l "message:,svnupdate,svndelete,svnaddnew,debug,help" -n "$0" -- "$@"); 349 365 350 366 #Bad arguments … … 365 381 exit 0 366 382 ;; 383 -a|--svnaddnew) 384 shift; 385 if [ "x$mode" == "xsvnupdate" ] || [ "x$mode" == "xsvndelete" ]; then 386 echo 387 echo "Can't use both svnaddnew and svndelete/svnupdate" 388 usage 389 exit 1 390 else 391 mode=svnaddnew 392 # echo "svnaddnew not yet implemented" 393 # exit 0 394 fi 395 ;; 367 396 -x|--svndelete) 368 397 shift; 369 if [ "x$mode" == "xsvnupdate" ] ; then398 if [ "x$mode" == "xsvnupdate" ] || [ "x$mode" == "xsvnaddnew" ]; then 370 399 echo 371 echo "Can't use both svndelete and svnupdate "400 echo "Can't use both svndelete and svnupdate/svnaddnew" 372 401 usage 373 402 exit 1 … … 378 407 -u|--svnupdate) 379 408 shift; 380 if [ "x$mode" == "xsvndelete" ] ; then409 if [ "x$mode" == "xsvndelete" ] || [ "x$mode" == "xsvnaddnew" ]; then 381 410 echo 382 echo "Can't use both svn delete and svnupdate"411 echo "Can't use both svnupdate and svndelete/svnaddnew" 383 412 usage 384 413 exit 1 … … 441 470 442 471 # move the existing collect folder out of the way 443 if [ -e collect ] && [ ! -e collect_orig ] ; then 472 # unless we are adding a new collection to svn, in which case, we'll grab them from whatever collect folder exists 473 if [ "x$mode" != "xsvnaddnew" ] && [ -e collect ] && [ ! -e collect_orig ]; then 444 474 mv collect collect_orig 445 475 fi … … 464 494 # (or if collections are specified in the cmdline arguments, copy just these over from model-collect into collect) 465 495 # Then remove the copy's .svn folders 466 echo "***********************************************" 467 echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:" 468 echo 469 if [ -e collect_orig ]; then 496 if [ "x$mode" != "xsvnaddnew" ] && [ -e collect_orig ]; then 497 498 echo "***********************************************" 499 echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:" 500 echo 501 470 502 if [ ! -e collect ]; then 471 503 cp -r model-collect collect … … 486 518 fi 487 519 fi 488 fi 489 echo "***********************************************" 520 echo "***********************************************" 521 fi 522 490 523 491 524 # Set up the Greenstone environment for building … … 508 541 if [ "x$mode" == "xsvnupdate" ]; then 509 542 update_single_collection $collection 543 elif [ "x$mode" == "xsvnaddnew" ]; then 544 svn_add_new_collection $collection 510 545 fi 511 546 fi 512 547 done 513 548 514 # having rebuilt all the collections, just the processing for svndelete /updateremains:549 # having rebuilt all the collections, just the processing for svndelete remains: 515 550 if [ "x$mode" == "xsvndelete" ]; then 516 551 svn_delete … … 531 566 if [ "x$mode" == "xsvnupdate" ]; then 532 567 update_single_collection $collection 568 elif [ "x$mode" == "xsvnaddnew" ]; then 569 svn_add_new_collection $collection 533 570 fi 534 571 fi 535 572 else 573 echo 536 574 echo "Can't find collection $collection. Skipping." 575 echo 537 576 fi 538 577 done 539 578 540 # having rebuilt the specified collections above, just the processing for svndelete /updateremains579 # having rebuilt the specified collections above, just the processing for svndelete remains 541 580 if [ "x$mode" == "xsvndelete" ]; then 542 581 svn_delete $@ 543 582 fi 544 545 583 fi 546 584 … … 566 604 elif [ "x$mode" == "xsvndelete" ]; then 567 605 echo "* The model-collect folder's archives and index subfolders have been updated and committed to svn." 606 elif [ "x$mode" == "xsvnaddnew" ]; then 607 echo "* The new collection(s) have been built, copied to model-collect and added to svn." 568 608 fi 569 609 echo … … 586 626 fi 587 627 588 echo "* The original collect directory has been left renamed as collect_orig" 589 echo 628 if [ -e collect_orig ]; then 629 echo "* The original collect directory has been left renamed as collect_orig" 630 echo 631 fi 590 632 591 633 if [ "$debug_mode" -eq "1" ]; then
Note:
See TracChangeset
for help on using the changeset viewer.