Question:
How to Archive VSS Project in Visual Source Safe (VSS)?
How to Restore VSS Project in Visual Source Safe (VSS)?
What is SSARC Utility?
What is SSRESTOR Utility?
SSARC Utility
Allows you to archive files, projects, or old versions from a Visual SourceSafe database. Each time you run SSARC (Ssarc.exe), the utility asks only once before it deletes the files/projects. Visual SourceSafe also implements archive operations through its Archive wizard, available in Visual SourceSafe Administrator.
The utility SSRESTOR is used for restoration of archived files. Use of SSARC and SSRESTOR together allows wide-area Visual SourceSafe installations to move files and projects among databases.
Limitation: SSARC cannot create an archive file that is greater than 2 GB. If you try to archive a project larger than this, you will receive an Out of Memory and/or a CRC mismatch error message. To work around this limitation, you will need to archive each subproject.
Syntax
ssarc [-C][-D][-I-][-O][-S][-V][-X][-Y] <archive file to create> <files/projects to archive>
If you are not familiar with the syntax conventions used, <
and >
are used to delimit arguments. The < and > characters are not typed in. The |
means a choice of options. Items enclosed in square brackets, []
are optional, and items not enclosed in square brackets are mandatory.
Utility Options
The following table describes options available with SSARC.
-C
Specifies a comment (standard Visual SourceSafe parameter). The comment is inserted into the Visual SourceSafe history if the items are deleted from the database as part of the archived record. The comment is also inserted into the archive file itself, if there is one.
-C-
Specifies no comment.
-D
Deletes the archived items from the database.
Specifiying the -d option will delete from your project the items that you are archiving. This will delete your project from Sourcesafe if you use it! Of course, you can restore from your backup file, but for normal use, and for smaller projects I don’t recommend this. This function obviously has its uses, but be sure you want to do this.
-D-
Controls whether Visual SourceSafe actually deletes anything from the database. If this option is not used, the default is to ask.
If the -d- option is used, then SSARC will not delete the projects the items you are archiving. The default is to prompt the user interactively, so if you want to run this from a script, you will need to choose one of the options, or use the -i- flag
-I-
Specifies no prompt for input (standard Visual SourceSafe parameter).
-O
Paginates or redirects output (standard Visual SourceSafe parameter).
-S<srcsafe.ini path>, <data path>
Specifies a path to Srcsafe.ini and the Data directory. The full syntax looks like -Sc: \VSS, OldDB. The item before the comma is the full path to Srcsafe.ini, and the item after the comma is the string in parentheses in a Data_Path setting. If there is no comma, a Srcsafe.ini path is indicated, but no data string. If the first character after the –S is a comma, a data string is specified, but no Srcsafe.ini path.
-V[D|L]<version>
Specifies a version number to archive (standard Visual SourceSafe parameter). Enter the version number in standard Visual SourceSafe format (number, date, or label). If this option is not used, SSARC operates on entire files or projects, instead of all versions up to and including a certain version.
Note that SSARC is generally inclusive. That is, if you type –V9, you create an archive file that contains version 9.0 and everything before it. The delete pass is also inclusive, that is, version 9.0 is actually deleted unless it is in the label format. In the latter case, the label is stored in the archive file but is not deleted. If –V is specified, you never delete the current version, even if you specify -D9/9/99. If you are using a version the label format, and the label has a space in it, you must place the entire option in quotation marks, for example, “-VThisOne”.
-X
Archives only deleted items in the specified files and projects. Deleted items are still stored in the Visual SourceSafe database unless the Destroy Permanently option is selected when performing a Delete command.
-X-
Archives all items in the specified files and projects.
-Y<user>,<pwd>
Specifies the user name and password (standard Visual SourceSafe parameter). An example is -YAdmin,Bunny.
archive file to create
Specifies the name of the archive file to create during the archive operation.
files/projects to archive
Specifies files and projects to back up.
Examples
SSARC -d- -yadmin,password archive.ssa $/
- Backup the entire default Sourcesafe database to archive.ssa, leaving the database exactly as it is.
SSARC -d- "-vlProduction Release" -yadmin,password -olog.txt archive.ssa $/Test
- Backup everything since the version labelled ‘Production Release’ and create a log file with the results of the archiving process.
SSARC -d -x -yadmin,password archive.ssa "$/Project Global Domination" $/OtherProject
- Archive, and delete the deleted files from two projects.
SSARC -i -yadmin,password -olog.txt "-cArchive Everything" archive.ssa $/
- Archive the entire Sourcesafe database, while creating a log file, adding a comment, and running non-interactively, suitable for a scheduled task.
SSRESTOR Utility
Restores information from a previously created archive. If the restore operation attempts to create a duplicate file or project name, the operation fails. Visual SourcSafe also implements restore operations through its Restore wizard, available in Visual SourceSafe Administrator.
Limitation: SSRESTOR cannot restore a project that is larger than 2 GB. A project larger than this cannot be archived.
Syntax:
ssrestor [-C][-I-][-L][-O][-P<project>][-S][-T][-X][-Y]
<archive file to restore> [files/projects]
Utility Options
The following table describes options available with this command.
-C
Specifies a comment (standard Visual SourceSafe parameter). The comment is applied to the history entry for restored item(s).
-C-
Specifies no comment.
-I-
Specifies no input (standard Visual SourceSafe parameter).
-L
Specifies a list only, without any restoration.
-LA
Specifies a list of all files and subprojects listed under a project, for example, project $/A.
-O
Redirects output (standard Visual SourceSafe parameter).
-P<project>
Specifies a project to which to restore content. For instance, if you archive $/A/BAR.C and then restore it, it will be restored as $/A/BAR.C.
-S<srcsafe.ini path><data path>
Specifies a path to Srcsafe.ini and the Data directory.
-T
Tests the archive file for corruption, but does not actually restore from the archive.
-X, -X-
Identifies an item that you want to restore, for example, $/a/b. This option distinguishes between deleted projects and undeleted projects that have the same names. For example, if you have deleted $a/b and specify the -X option, SSRESTOR restores the deleted $/a/b. If you specify -X-, SSRESTOR restores an undeleted $/a/b. Even though they have the same name, note that these are two different projects that the utility treats differently.
-Y<user>,<pwd>
Specifies user name and password (standard Visual SourceSafe parameter). An example is -YAdmin,Moggy.
archive file to restore
Specifies the name of the archive file from which to restore the database.
files/projects
Specifies files and projects to restore.
Examples
SSRESTOR -la -yadmin,password archive.ssa $/
- Display a list of all of the files archived in archive.ssa.
SSRESTOR "-p$/Test 2" -sD:\newfolder\ -yadmin,password backup.ssa $/Test
- Restores project $/Test to the database to a new location, $/Test 2, from the archive file backup.ssa, in a different Sourcesafe database.
Miscellaneous tips
- Putting the path to the <VSS PATH>\win32 folder in your PATH environment variable makes shell commands a lot easier
- If you get a message “Only ADMIN can run this utility”, it means that you are either not specifying the admin account, or the password is incorrect. Use
"-yadmin,password"
if the admin password is “password”, or"-yadmin,"
if the admin password is not set (not recommended!). - If you are using an option that has a space in the argument, enclose the whole thing with quote marks, i.e. “-p$/Project A”
- A daily archive is easy to do with a Windows shell script, maybe something like this. Then use Scheduled Tasks to have this run every day.
function q (str) ' to make the command a bit more readable, I hope q = """" & str & """" end function
PROJECT = “$/”
USERID = “admin”
PASSWORD = “admin”‘ location of SSARC program
SSARCPATH = “C:\program files\microsoft visual studio\common\vss\win32\ssarc.exe”
‘ folder of srcsafe.ini
SRCSAFEINIPATH = “”
‘ prepended to filename in case you’re doing more than one.
LABEL = “ARCHIVE”
‘ destination of archive files
BACKUPFOLDER = “C:\BACKUPS\”‘ generate a name based on the time.
today = now()
backupfilename = LABEL & “-” & formatdatetime(now,2) & “.ssa”cmd = q(SSARCPATH) & ” ” & _
q(“-s” & SRCSAFEINIPATH & “,”) & ” -i- ” & ” -d- ” & _
q(“-y” & USERID & “,” & PASSWORD) & ” ” & _
q(BACKUPFOLDER & backupfilename) & ” ” & q(PROJECT)Set WshShell = WScript.CreateObject(“WScript.Shell”)
wscript.echo cmd
WshShell.run cmd
set wsshell = nothing
- Implementing Managed IT Services: A Step-by-Step Guide - August 30, 2024
- DevOps Foundation Certification - August 29, 2024
- SRE Foundation Certification - August 29, 2024