Index: other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh
===================================================================
--- other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh	(revision 28073)
+++ other-projects/nightly-tasks/diffcol/trunk/gen-model-colls.sh	(revision 28074)
@@ -100,4 +100,20 @@
 }
 
+function svn_add_new_collection () {
+
+    collection=$1
+
+    #escape the filename (in case of space) and get just the basename
+    collection=$(get_col_basename $collection)
+
+    if [ -e model-collect/$collection ];then
+	echo "svn_add_new_collection: $collection already exists in model-collect, can't add it to svn."
+	return
+    fi
+
+    find collect/$collection -name ".svn" -type d -exec rm -rf {} \;
+    cp -r collect/$collection model-collect/$collection
+    svn add model-collect/$collection    
+}
 
 # Function that handles the --svndelete flag (mode) of this script for a single collection
@@ -346,5 +362,5 @@
 # http://blog.onetechnical.com/2012/07/16/bash-getopt-versus-getopts/
 # Execute getopt
-ARGS=$(getopt -o m:uxdh -l "message:,svnupdate,svndelete,debug,help" -n "$0" -- "$@");
+ARGS=$(getopt -o m:uxadh -l "message:,svnupdate,svndelete,svnaddnew,debug,help" -n "$0" -- "$@");
 
 #Bad arguments
@@ -365,9 +381,22 @@
       exit 0
       ;;
+    -a|--svnaddnew)
+      shift;
+      if [ "x$mode" == "xsvnupdate" ] || [ "x$mode" == "xsvndelete" ]; then
+	  echo
+	  echo "Can't use both svnaddnew and svndelete/svnupdate"
+	  usage
+	  exit 1
+      else
+	  mode=svnaddnew
+#	  echo "svnaddnew not yet implemented"
+#	  exit 0
+      fi
+      ;;
     -x|--svndelete)
       shift;
-      if [ "x$mode" == "xsvnupdate" ]; then
+      if [ "x$mode" == "xsvnupdate" ] || [ "x$mode" == "xsvnaddnew" ]; then
 	  echo
-	  echo "Can't use both svndelete and svnupdate"
+	  echo "Can't use both svndelete and svnupdate/svnaddnew"
 	  usage
 	  exit 1
@@ -378,7 +407,7 @@
     -u|--svnupdate)
       shift;
-      if [ "x$mode" == "xsvndelete" ]; then
+      if [ "x$mode" == "xsvndelete" ] || [ "x$mode" == "xsvnaddnew" ]; then
 	  echo
-	  echo "Can't use both svndelete and svnupdate"
+	  echo "Can't use both svnupdate and svndelete/svnaddnew"
 	  usage
 	  exit 1
@@ -441,5 +470,6 @@
 
 # move the existing collect folder out of the way
-if [ -e collect ] && [ ! -e collect_orig ] ; then
+# unless we are adding a new collection to svn, in which case, we'll grab them from whatever collect folder exists
+if [ "x$mode" != "xsvnaddnew" ] && [ -e collect ] && [ ! -e collect_orig ]; then
     mv collect collect_orig
 fi
@@ -464,8 +494,10 @@
 # (or if collections are specified in the cmdline arguments, copy just these over from model-collect into collect)
 # Then remove the copy's .svn folders
-echo "***********************************************"
-echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:"
-echo
-if [ -e collect_orig ]; then
+if [ "x$mode" != "xsvnaddnew" ] && [ -e collect_orig ]; then
+
+    echo "***********************************************"
+    echo "Creating a copy of the model-collect folder as folder collect and removing the .svn subfolders from the copy:"
+    echo
+
     if [ ! -e collect ]; then
 	cp -r model-collect collect	
@@ -486,6 +518,7 @@
 	fi
     fi
-fi
-echo "***********************************************"
+    echo "***********************************************"
+fi
+
 
 # Set up the Greenstone environment for building
@@ -508,9 +541,11 @@
 	    if [ "x$mode" == "xsvnupdate" ]; then
 		update_single_collection $collection
+	    elif [ "x$mode" == "xsvnaddnew" ]; then
+		svn_add_new_collection $collection
 	    fi
 	fi
     done
 
-    # having rebuilt all the collections, just the processing for svndelete/update remains:
+    # having rebuilt all the collections, just the processing for svndelete remains:
     if [ "x$mode" == "xsvndelete" ]; then
 	svn_delete
@@ -531,16 +566,19 @@
 		if [ "x$mode" == "xsvnupdate" ]; then
 		    update_single_collection $collection
+		elif [ "x$mode" == "xsvnaddnew" ]; then
+		    svn_add_new_collection $collection
 		fi
 	    fi
 	else
+	    echo
 	    echo "Can't find collection $collection. Skipping."
+	    echo
 	fi
     done
 
-    # having rebuilt the specified collections above, just the processing for svndelete/update remains
+    # having rebuilt the specified collections above, just the processing for svndelete remains
     if [ "x$mode" == "xsvndelete" ]; then
 	svn_delete $@
     fi
-
 fi
 
@@ -566,4 +604,6 @@
 elif [ "x$mode" == "xsvndelete" ]; then
     echo "* The model-collect folder's archives and index subfolders have been updated and committed to svn."
+elif [ "x$mode" == "xsvnaddnew" ]; then
+    echo "* The new collection(s) have been built, copied to model-collect and added to svn."
 fi
 echo
@@ -586,6 +626,8 @@
 fi
 
-echo "* The original collect directory has been left renamed as collect_orig"
-echo
+if [ -e collect_orig ]; then
+    echo "* The original collect directory has been left renamed as collect_orig"
+    echo
+fi
 
 if [ "$debug_mode" -eq "1" ]; then
