Game Development Community

dev|Pro Game Development Curriculum

CVS automated batch updates

by Bil Simser · 07/07/2003 (10:28 am) · 1 comments

As some of you use WinCVS to get your updates to HEAD, I've found it a bit of pain and something that should be simple. There is a TCL plugin for WinCVS but that was another scripting language I didn't want to pick up and for those that prefer the command line I like this approach. It's a simple DOS style batch file that will login to CVS and grab the HEAD release of Torque.

It's automatic (with minimal error checking) but can be automated through the task scheduler (I have mine running every week to grab whatever updates are available). Optionally you can run your compiler after getting the files and rebulid the system so Saturday morning you're good to go with a new version. This can also be easily turned into a shell script to do the same thing for Linux.

Replace the and parts with your own values as I'm not about to share mine with you ;)

Just as a side note, I pull down a copy of HEAD but that's my virgin copy. I actually build from a duplicate of HEAD where I do any mods. After pulling down HEAD from CVS each week, I merge in any changes with my work directory so it keeps the head copy clean. That's just how I work, your milage may vary.

Hope this resource makes your life simpler.

rem
rem This simple batch file checks out the HEAD revision from CVS
rem using the command line version of CVS.EXE. It also does
rem basic errorlevel checking to make sure everything works
rem and builds the HEAD revision after a successful checkout
rem
rem If you build from the HEAD release you could trigger a build
rem script (using Ant, NAnt or another makefile) to rebuild the system
rem

@echo off

cls
echo Torque HEAD Grabber v1.0
echo.
echo A simple batch file (can be run as a scheduled task) to
echo grab the HEAD release from Garage Games CVS repository
echo and download to your system.
echo.

rem
rem Set the CVS root to point to where HEAD is
rem
set CVSROOT=:pserver:<username>@cvs.garagegames.com:/cvs/torque

rem
rem This logs us in using our password (yes, clear text so not secure but automated)
rem
cvs -z6 -d :pserver:<username>:<password>@cvs.garagegames.com:/cvs/torque login
if errorlevel 0 goto gethead
goto exit

rem
rem So far so good, now grab the HEAD release
rem

:gethead
echo Login successful
echo.

rem
rem Optional. I keep the HEAD release in a HEAD directory so comment out
rem the next line and the cd later if you want to just grab it in the current dir
rem

cd head

echo Getting HEAD release... please wait
cvs -z6 update -P -d
if errorlevel 0 goto logout
goto exit

rem
rem Everything worked and we now have an updated HEAD release so logout of CVS
rem

:logout
echo Update complete... cleaning up

rem
rem Optional. If you have your HEAD release in a subdir this just backs out again.
rem Comment out if you just grab it in the current dir.
rem

cd ..

cvs logout
goto exit

rem
rem Clean up and clear our environmental variable. You could do an automated build here if you wanted.
rem

:exit
set CVSROOT=
echo All done!

#1
07/16/2003 (6:23 am)
rem:gethead
echo Login successful
:P

nice script ...sorry could not resist the cheap shot