Showing posts with label Get. Show all posts
Showing posts with label Get. Show all posts

Tuesday, 12 January 2010

VSS Batch File Apply Patched Files

Below is an example of how I get a base version of my files in VSS and then apply (overwrite) any other files that are in the patch for that version.

My batch file takes 3 arguments:
1. SSDIR
2. Base label
3. Patch label

Here is an example of calling the batch file GetPatch.bat:

"C:\Documents and Settings\shane\Desktop\GetPatch.bat" \\myVSS\Sourcesafe "v0.0.1" "v0.0.1 Patch 4"

Note your label must start with a leter i.e. v0.0.1 in order for the version to be picked up.

Another thing to note is you must go into VSS and click on Tools > Options and then tick the option "Act on projects recursively".

GetPatch.bat
------------

@ECHO OFF
CLS
ECHO Arguments
ECHO =========
ECHO.
ECHO 1. SSIDR: %~1
ECHO 2. Base label: %~2
ECHO 2. Patch label: %~3
ECHO.

IF "%~1"=="" GOTO ArgumentInvalid
IF "%~2"=="" GOTO ArgumentInvalid
IF "%~3"=="" GOTO ArgumentInvalid

SET SSDIR=%~1
ECHO Getting base files for label "%~2". Please be patient this will take a few minutes.
"C:\Program Files\Microsoft Visual SourceSafe\SS.exe" GET $/VSSProject/Project1/*.* -GF -VL"%~2"
ECHO Getting patch files for label "%~3". Please be patient this will take a few minutes.
"C:\Program Files\Microsoft Visual SourceSafe\SS.exe" GET $/VSSProject/Project1/*.* -GF -VL"%~3"

ECHO.
ECHO Done
GOTO Exit

:ArgumentInvalid
ECHO Missing arguments. Not able to continue.

:Exit
ECHO.
PAUSE

Wednesday, 30 July 2008

VSS get from label using a BAT file

It is recommended that you if you want to retrieve files from a label in VSS you always get it from command line using the SS GET command. When done in this way it will always get the correct version in case there was a label move operation on a particular file.

For example:

echo off
cls
c:
cd "C:\Program Files\VSS\win32\"
set SSUSER=username
set SSDIR=\\blah\Data\Applications\SourceSafe\Development\
ss Get $/Blah/Development/Code/dh/*.* -R -VL"LabelName" -GF -I-Y
if %errorlevel% equ 100 goto error
if %errorlevel% equ 0 goto end
:error
echo %errorlevel% Source Safe Error
:end
echo Finished
pause

Version not found? Read here: http://support.microsoft.com/kb/197050