How To: Diff/Compare Two Labels in Visual SourceSafe

This batch script creates a text file containing the differences between two labels of a SourceSafe project and all of its sub-projects. It was originally posted to microsoft.public.visualsourcesafe by Weston Morris.  Thanks Weston!

@ECHO OFF

 REM This batch file will create a text file containing the differences

 REM between 2 labels of a project and all sub-projects off of that project.

 

 REM The project name and labels must not contain any spaces.

 

 REM The env variable SSDIR must point to the the path where VSS is installed on your machine.

 

 if "%SSDIR%" == "" GOTO NO_SSDIR

 if "%1"=="HELP" GOTO HELP

 if "%1"=="/?" GOTO HELP

 if "%1"=="-?" GOTO HELP

 if "%1"=="?" GOTO HELP

 if "%1"=="" GOTO NO_PROJ

 if "%2"=="" GOTO NO_NEW_LABEL

 if "%3"=="" GOTO NO_OLD_LABEL

 

 :COMPARE

 ECHO Gathering data. Please wait....

 del delta.txt /F /Q

 echo %ssdir%\win32\ss history %1 -VL%2~%3 %4 %5 %6 %7 %8 %9 -i- -odelta.txt

     %ssdir%\win32\ss history %1 -VL%2~%3 %4 %5 %6 %7 %8 %9 -i- -odelta.txt

 IF ERRORLEVEL 100 GOTO VSS_FAILURE

 IF ERRORLEVEL 1 GOTO VSS_NO_FILES

 

 REM Exit code 0, history command was successful

 ECHO Complete.

 delta.txt

 GOTO EXIT

 

 REM Exit code 1,

 :VSS_NO_FILES

 ECHO No changes in that range of labels.

 GOTO EXIT

 

 REM Exit code 100, VSS failure

 :VSS_FAILURE

 ECHO VSS Failed. 

 ECHO Do you have access to the database?

 ECHO Is this a valid project name? "%1"

 ECHO Is this a valid newer label?  "%2"

 GOTO EXIT

 

 :NO_SSDIR

 ECHO You must have the SSDIR env variable set up to point to the folder where

 ECHO VSS was installed on your machine.

 GOTO EXIT

 

 :NO_PROJ

 :NO_OLD_LABEL

 :NO_NEW_LABEL

 ECHO You must supply a VSS project, new label and old label.

 GOTO EXAMPLES

 

 :EXAMPLES

 :HELP

 ECHO Command Syntax:

 ECHO    DUMP_DELTA {project name} {new project label}

 ECHO               {old project label} [other VSS options]

 ECHO    {project name} is the VSS project name (no spaces allowed in the name)

 ECHO    {new project label} is the newer label (no spaces allowed in the label)

 ECHO    {old project label} is the older label (no spaces allowed in the label)

 ECHO    [other VSS options] are a list of other SS options such as:

 ECHO        -R  Display the history of an entire project list.

 ECHO        -L  Display only versions that have labels.

 ECHO        -F- Do not display individual file updates in the project history.

 ECHO        -B  Display a brief history.

 ECHO        -U  Display only changes made by a particular user.

 ECHO        -I- Ignore: Do not ask for input under any circumstances.

 ECHO        -Y Specify a username and/or password.

 ECHO Examples of how to start this batch file:

 ECHO    DUMP_DELTA DP1XXX_3.1.4 DP1XXX_3.1.0

 ECHO    DUMP_DELTA PR_233 PR_230 -R -UWeston

 GOTO EXIT

 

 :EXIT

++++++++++++++++++++++++++
This posting is provided "AS IS" with no warranties, and confers no rights.

Published 28 October 03 07:54 by KorbyP

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Martin Brown said on October 29, 2003 6:50 AM:
There is a minor flaw in this script. It assumes that the source safe executable files (ss.exe) are in the same place as the database. To resolve this you can remove the %ssdir%\win32\ from the front of the command and ensure that ss.exe is on the path before running the script.
# Scott McCulloch said on January 23, 2004 7:35 PM:
# William Bartholomew said on March 28, 2004 3:43 PM:
Thanks! This will come in handy for sure.
# jayshree said on February 7, 2006 4:05 AM:
Labels used in our VSS database contain spaces. Is there any way i can get list of changed files between two labels then.

Please advise
# buy cyprus in property said on August 27, 2006 2:41 PM:
Very informative post about <a href="http://businessloannew.bravehost.com/buy-cyprus-in-property.html"">http://businessloannew.bravehost.com/buy-cyprus-in-property.html" title="buy cyprus in property">buy cyprus in property</a> and [URL=http://businessloannew.bravehost.com/buy-cyprus-in-property.html]buy cyprus in property[/URL]
# essiac said on September 8, 2006 12:15 AM:
Thanks for the great tips about <a href="http://nolanfam.250free.com/essiac.html"">http://nolanfam.250free.com/essiac.html" title="essiac">essiac</a> and [URL=http://nolanfam.250free.com/essiac.html]essiac[/URL]

Leave a Comment

(required) 
(optional)
(required) 

Search

Go

This Blog

Syndication

Page view tracker