Changeset 28081

Show
Ignore:
Timestamp:
16.08.2013 20:04:02 (6 years ago)
Author:
ak19
Message:

The svnaddnew flag now ensures that the cache and log folders and any earliestDatestamp files are not copied over from the local collect to the version model-collect folder before trying to add it. Have not yet included support for the svn:ignore on these items, because it's possible to have an ignorelist in a file that is applied recursively. Want to discuss this first.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh

    r28074 r28081  
    100100} 
    101101 
     102# model-collect>svn -R propset svn:ignore -F .customignore . 
     103# where .customignore is a file containing: 
     104# log 
     105# earliestDatestamp 
     106# cache 
     107# model-collect>svn proplist -v 
     108# shows the svn properties, including the svn:ignore property. So it shows what files svn will ignore 
    102109function svn_add_new_collection () { 
    103110 
     
    112119    fi 
    113120 
    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     
     121    # Using rsync to copy folders while excluding files/subfolders, BUT rsync is not available on lsb 
     122    # http://www.linuxquestions.org/questions/linux-software-2/copy-svn-working-dir-without-svn-hidden-dirs-and-files-620586/ 
     123    # See also http://www.thegeekstuff.com/2011/01/rsync-exclude-files-and-folders/,  
     124    # section "Exclude multiple files and directories at the same time" (can also use a file to blacklist folders/files) 
     125 
     126    # need slash on end of src dir collect/$collection/ ! 
     127    rsync -r --exclude=.svn/ --exclude=log/ --exclude=cache/ --exclude=earliestDatestamp collect/$collection/ model-collect/$collection 
     128 
     129#    find collect/$collection -name ".svn" -type d -exec rm -rf {} \; 
     130#    cp -r collect/$collection model-collect/$collection 
     131 
     132    # http://www.thegeekstuff.com/2010/06/bash-array-tutorial/ 
     133#    ignorelist=('log' 'cache' 'archives/earliestDatestamp'); 
     134#    for ignored in "${ignorelist[@]}"; do 
     135#   if [ -f model-collect/$collection/$ignorelist ]; then 
     136#       rm model-collect/$collection/$ignorelist 
     137#   elif [ -d model-collect/$collection/$ignorelist ]; then 
     138#       rm -rf model-collect/$collection/$ignorelist 
     139#   fi 
     140#    done 
     141 
     142    svn add --force model-collect/$collection 
     143     
     144    # http://stackoverflow.com/questions/15880249/subclipse-svn-first-commit-ignore-certain-directories 
     145    # http://wolfram.kriesing.de/blog/index.php/2005/svnignore-and-svnkeywords 
     146    # http://boblet.tumblr.com/post/35755799/setting-up-and-using-svn-ignore-with-subversion 
     147    # http://www.petefreitag.com/item/662.cfm 
     148    # http://svnbook.red-bean.com/en/1.7/svn.advanced.props.special.ignore.html 
     149    # http://stackoverflow.com/questions/116074/how-to-ignore-a-directory-with-svn 
     150 
     151    # Dr Bainbridge's way of doing an svn ignore is better and involves fewer steps: 
     152    # create the empty collection folder (-p for subcollections), svn add it,  
     153    # svn:ignore all the files to be ignored 
     154    # copy the contents of the collection across,  
     155    # do an svn add --force on the collection folder 
     156 
     157    #mkdir -p model-collect/$collection 
     158    #svn add model-collect/$collection 
     159    #ignorelist=('log' 'cache' 'archives/earliestDatestamp'); 
     160    #for ignored in "${ignorelist[@]}"; do 
     161    #    svn propset svn:ignore $ignorelist model-collect/$collection/. 
     162    #done     
     163    # cp -r collect/$collection/* model-collect/$collection/* 
     164    #svn add --force model-collect/$collection 
    117165} 
    118166 
     
    228276    cp -r collect/$collection/index model-collect/$collection/.  
    229277 
     278    # need a --force to skip all the svn:ignored files (archives/earliestDatestamp)  
     279    # when doing the recursive svn add on the archives and index directories 
    230280    if [ "$debug_mode" -eq "0" ]; then 
    231     svn add model-collect/$collection/archives 
    232     svn add model-collect/$collection/index 
     281    svn add --force model-collect/$collection/archives 
     282    svn add --force model-collect/$collection/index 
    233283    fi 
    234284} 
     
    308358    # now svn add any and all the NEW items in model-collect's archives and index 
    309359    # see http://stackoverflow.com/questions/1071857/how-do-i-svn-add-all-unversioned-files-to-svn 
     360    # see also http://stackoverflow.com/questions/116074/how-to-ignore-a-directory-with-svn 
    310361#    if [ "$debug_mode" -eq "0" ]; then 
    311362    svn add --force model-collect/$collection/archives/* --auto-props --parents --depth infinity -q 
     
    491542fi 
    492543 
     544# Not using rsync to copy folders while excluding files/subfolders, since rsync is not available on lsb 
     545# http://www.linuxquestions.org/questions/linux-software-2/copy-svn-working-dir-without-svn-hidden-dirs-and-files-620586/ 
     546# rsync -r --exclude=.svn/ model-collect/ collect 
     547 
    493548# Make a copy of the model-collect named as the new collect  
    494549# (or if collections are specified in the cmdline arguments, copy just these over from model-collect into collect) 
     
    601656    echo "* The model-collect folder has not been altered. Changes have only been made to collect" 
    602657elif [ "x$mode" == "xsvnupdate" ]; then 
    603     echo "* TO DO: You still need to run svn status and then svn commit on the model-collect folder. Besides that:"     
     658    echo "* TO DO: You still need to run svn status and svn commit on the model-collect folder. Besides that:"     
    604659elif [ "x$mode" == "xsvndelete" ]; then 
    605660    echo "* The model-collect folder's archives and index subfolders have been updated and committed to svn." 
    606661elif [ "x$mode" == "xsvnaddnew" ]; then 
    607662    echo "* The new collection(s) have been built, copied to model-collect and added to svn." 
     663    echo "* TO DO: You still need to run svn status and svn commit on the model-collect folder. Besides that:"  
    608664fi 
    609665echo