#!/bin/csh -f

set TERM = 202110
set REPO_FOLDER = ${TERM}-git-repo
set URL = https://github.com/RHIT-CSSE/csse120-public.git

# For cloning just the relevant part of the repository:

if (-e ${REPO_FOLDER}) then
  echo "Need to clone to an EMPTY folder.  Nothing done."
  exit 1
endif

mkdir ${REPO_FOLDER}
cd ${REPO_FOLDER}
git init
git remote add -f origin ${URL}

git config core.sparseCheckout true

echo "WWW/202110" > .git/info/sparse-checkout

git pull --depth=1 origin master

exit 1

# PART 1: Publish the material in the repository below Public/TERM.

set SUFFIX = ""
set TARGET_DIR = /class/csse/csse120/${TERM}${SUFFIX}




if ("`/bin/ls ${TARGET_DIR}`" == "") then
	# To checkout the selected portion of the repository to here:
	svn co http://svn.csse.rose-hulman.edu/repos/$REPO ${TARGET_DIR}
else
	# Thereafter, to update:
	svn up ${TARGET_DIR}
endif

exit


# PART 2: Publish the material in the repository below Public that is slow-to-change:
#  Images
#  Resources
#  VideoFiles

# foreach FOLDER (Images Resources VideoFiles)
foreach FOLDER (VideoFiles)

  set TARGET_DIR = /class/csse/csse120/$FOLDER

  if (! -e ${TARGET_DIR}) then
	mkdir ${TARGET_DIR}
  endif

  set REPO = csse120-python/branches/robonew/Public/${FOLDER}/

  if ("`/bin/ls ${TARGET_DIR}`" == "") then
	# To checkout the selected portion of the repository to here:
	svn co http://svn.csse.rose-hulman.edu/repos/$REPO ${TARGET_DIR}
  else
	# Thereafter, to update:
	svn up ${TARGET_DIR}
  endif
end


exit

# Rest is the OLD script, for SVN.

#!/bin/csh -f

set TERM = 202030

# PART 1: Publish the material in the repository below Public/TERM.

set SUFFIX = ""
set TARGET_DIR = /class/csse/csse120/${TERM}${SUFFIX}

if (! -e ${TARGET_DIR}) then
	mkdir ${TARGET_DIR}
endif

set REPO = csse120-python/branches/robonew/Public/${TERM}/

if ("`/bin/ls ${TARGET_DIR}`" == "") then
	# To checkout the selected portion of the repository to here:
	svn co http://svn.csse.rose-hulman.edu/repos/$REPO ${TARGET_DIR}
else
	# Thereafter, to update:
	svn up ${TARGET_DIR}
endif

exit


# PART 2: Publish the material in the repository below Public that is slow-to-change:
#  Images
#  Resources
#  VideoFiles

# foreach FOLDER (Images Resources VideoFiles)
foreach FOLDER (VideoFiles)

  set TARGET_DIR = /class/csse/csse120/$FOLDER

  if (! -e ${TARGET_DIR}) then
	mkdir ${TARGET_DIR}
  endif

  set REPO = csse120-python/branches/robonew/Public/${FOLDER}/

  if ("`/bin/ls ${TARGET_DIR}`" == "") then
	# To checkout the selected portion of the repository to here:
	svn co http://svn.csse.rose-hulman.edu/repos/$REPO ${TARGET_DIR}
  else
	# Thereafter, to update:
	svn up ${TARGET_DIR}
  endif
end
