[cvsnt] Automating some basic functionality of CVSNT

Tyler Theobald tyler.theobald.junk at cox.net
Tue Feb 24 21:18:39 GMT 2004


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


Here ya go Randy, I haven't used this in production yet, just wrote it a
couple weeks ago with some initial testing and it works well so far.  This
addresses some of your concerns...

::  PROCESS NAME : CVS_Update_By_Tag
::  FUNCTION     : Updates a target location with CVS files via module/tag
::                 Requires target location directory structure to match
module directory structure
::  CONTACT      : TYLER THEOBALD
::
::  PARAMETERS   : %1 = Repository
::                 %2 = Module
::                 %3 = Tag
::                 %4 = UNC path to target location
::  VARIABLES    : %checkout_server% = CVS Server Name
::  EXECUTABLES  : cvs.exe
::

:: When putting this back on the agent server....
:: change c: to D:
:: unREM
:: remove set checkout_server / and set it to cvs_server in the environment
bat

:: Might set this up to run each night and CHECK to see if there's any files
to migrate - That way, migrations would reliably happen at the same time on
each occurence.

:: ::::for testing only:::::
set checkout_server=nnoma-apcvs01d

echo on

REM %APPDRV%

c:
cd\

TIME /T

set CVSROOT=:SSPI:%checkout_server%:/%1

:: IF OLD TEMP DIR EXISTS, DELETE IT
::----------------------------------
IF EXIST c:\checkout_temp rd /s /q c:\checkout_temp
IF %ERRORLEVEL% NEQ 0 GOTO ABEND

:: MAKE TEMP DIR TO CHECKOUT FILES INTO
::-------------------------------------
c:
cd\
md checkout_temp
cd checkout_temp
IF %ERRORLEVEL% NEQ 0 GOTO ABEND

:: CHECKOUT FILES WITH SPECIFIED TAG
::----------------------------------
cvs checkout -r %3 %2
IF %ERRORLEVEL% NEQ 0 GOTO ABEND

:: MAKE SURE TARGET LOCATION IS THERE
::-----------------------------------
IF NOT EXIST %4\%2 GOTO ABEND

::SET NOW TO CURRENT DATE & TIME WITH CHARACTERS LEGAL FOR CVS TAGS
::-----------------------------------------------------------------
::set now to current date & time
set now=%date%_%time%
::get rid of space
set now=%now: =_%
::get rid of .xx on time
set now=%now:~0,-6%
::get rid of :
set now=%now::=%
::get rid of /
set now=%now:/=%

:: PROCESS TO MAKE BACKUP OF TARGET FILES THAT WILL BE REPLACED FOR EASY
MIGRATION BACK OUTS
::--------------------------------------------------------------------------
----------------
:: Make backup of files to be migrated
::------------------------------------
robocopyXP c:\checkout_temp c:\Migration_Replaced\Replaced_%now% /s /XD CVS

:: Copy all files from destination that exist to backup and delete those
that don't exist
::--------------------------------------------------------------------------
-------------
robocopyXP %4\%2 c:\Migration_Replaced\Replaced_%now% /XL /purge /s

:: ROBOCOPYXP FILES TO TARGET LOCATION
:: (don't overwrite newer files & exclude hidden files/dirs (CVS dir))
::--------------------------------------------------------------------
robocopyXP %2 %4\%2 /s /np /R:4 /W:30 /TS /V /XO /XA:H /NJH /NS /TEE /XD CVS
/LOG:c:\robocopy_output.txt
if %errorlevel% EQU 16 echo  ***FATAL ERROR***  & goto ABEND
if %errorlevel% EQU 15 echo FAIL MISM XTRA COPY & goto INCOMPLETE
if %errorlevel% EQU 14 echo FAIL MISM XTRA      & goto INCOMPLETE
if %errorlevel% EQU 13 echo FAIL MISM      COPY & goto INCOMPLETE
if %errorlevel% EQU 12 echo FAIL MISM           & goto INCOMPLETE
if %errorlevel% EQU 11 echo FAIL      XTRA COPY & goto INCOMPLETE
if %errorlevel% EQU 10 echo FAIL      XTRA      & goto INCOMPLETE
if %errorlevel% EQU 9 echo FAIL           COPY & goto INCOMPLETE
if %errorlevel% EQU 8 echo FAIL                & goto INCOMPLETE
if %errorlevel% EQU 7 echo      MISM XTRA COPY & goto INCOMPLETE
if %errorlevel% EQU 6 echo      MISM XTRA      & goto INCOMPLETE
if %errorlevel% EQU 5 echo      MISM      COPY & goto INCOMPLETE
if %errorlevel% EQU 4 echo      MISM           & goto INCOMPLETE

if %errorlevel% EQU 0 echo    --no change--   & goto NOTHING

:: ANY SKIPS?  Were any files skipped because they were the same as
destination?
::--------------------------------------------------------------------------
----
findstr /B .*same.*/.*: c:\robocopy_output.txt
IF %ERRORLEVEL% EQU 0 GOTO INCOMPLETE

:: ANY SKIPS?  Were any files skipped because they were older than
destination?
::--------------------------------------------------------------------------
---
findstr /B .*older.*/.*: c:\robocopy_output.txt
IF %ERRORLEVEL% EQU 0 GOTO INCOMPLETE

:: ADD TAG ON MIGRATED FILES TO "MIGRATED_<DATE/TIME>"
::----------------------------------------------------
cvs tag -c "MIGRATED_%now%"
IF %ERRORLEVEL% NEQ 0 GOTO INCOMPLETE

:: REMOVE TEMP DIR
::----------------
cd\
rd /s /q c:\checkout_temp
IF %ERRORLEVEL% NEQ 0 GOTO ABEND


::::::::::::::::
:: END OF JOB ::
::::::::::::::::
TIME /T
rem EXIT 0

pause

:INCOMPLETE
::::::::::::::::::::::::::
::  FILES WERE SKIPPED  ::
:: INCOMPLETE MIGRATION ::
::   TAG NOT APPLIED    ::
::::::::::::::::::::::::::
TIME /T
rem EXIT 2

pause

:NOTHING
::::::::::::::::::::::
:: NOTHING MIGRATED ::
::::::::::::::::::::::
TIME /T
rem EXIT 3

pause

:ABEND
::!!!!!!!!!!!!!!!!!!!!!!!!!!!
::! J O B   A B E N D E D !!!
::!!!!!!!!!!!!!!!!!!!!!!!!!!!
TIME /T
rem EXIT 1

pause

cd \sandbox\inf\tes
"RANDY BURNS" <RBURNS at tacoma.k12.wa.us> wrote in message
news:mailman.508.1077653299.472.cvsnt at cvsnt.org...
> I manage a substantial collection of html documents and images (about a
> gig all together). We've
> been using CVSNT to handle version control using WinCVS-and that has
> worked fine for myself
> and another developer. We have a couple of production control
> operators that handle movement of changes onto production. I would
> really like to make things
> simple for these folks.
>
> What I would ideally like is for the production control folks to simply
> be able to copy a directory to a
> cvs active directory and have any changes checked into cvs by a script
> that runs as a scheduled task.
>
> Now, what I've seen here is that if I copy files, I have a couple of
> issues:
> 1) there is a need to do a recusive add of new files. Wincvs has
> something that is supposed to do this,
>     but it hangs--and I need something I can run from the command line
> so I can run it as a
>     scheduled task.
>
> 2) there is a need to sort out the situation where a file has been
> replaced by a file with
>     indentical contents. These files may be copied from another machine
> so the timestamps
>     may differ but the contents are the same.  In wincvs, if I copy and
> identical file with
>     a different timestamp than the original and try to commit it, the
> file gets tagged
>    (highlighted as red and marked as a mod file). If I commit the file
> I get something like
>    ***** CVS exited normally with code 0 *****
>    and the file is still marked as a mod file.
>
> I guess I could just write a script that only moved the added/changed
> files to handle 2).
> I thought I would ask if there are scripts around that handle some of
> these conditions.
>
> Thanks!
> RJB
>





More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook