Nick Vaccaro
Nick Vaccaro

Reputation: 5504

Visual Source Safe Automated Commit

I am currently attempting to set up an automated add/checkout/checking script using MS Visual Source Safe via command line. Online documentation is... lacking... and I was hoping that someone else had tried doing something like this in the past.

Before going any further, I am well aware that there are other, better alternatives to VSS, so please don't give "use SVN" as an answer.

The files I've got are a scripted version of our database schema, and looks like this in the repo:

$/project_name/DBScripts/servers/databases/object_types, where object_types are Tables, StoredProcedures, etc.

I am attempting to do the following:

1- Script all database object to files. This part is done and working correctly.
2- Add all new files to repo.
3- Commit all files that have changed. Make sure files do NOT remain checked out or read-only.

EDIT 2:

Removed old code again. Included current code below. Add works correctly, but the checkout command does NOT work on any files that were changed locally.

In this context, if I were to modify stored proc A, script it to file, then try running the batch commands below, all procs BUT A will be checked out.

I've included 2 examples of the checkout command. Neither is working...

set PATH=%path%;C:\Program Files\Microsoft Visual SourceSafe
set SSDIR=repo_path

cd DBScripts/server/database/StoredProcedures
ss cp $/project/DBScripts/server/database/StoredProcedures

for %%F in (*.*) do ss add %%~nF%%~xF -C- -I-N -K- -W
for %%F in (*.*) do ss checkout $/project/DBScripts/server/database/StoredProcedures/%%~nF%%~xF -C- -G- -M- -L+
ss checkout $/project/DBScripts/server/database/StoredProcedures *.* -C- -G- -M- -L+ -Vltemp
for %%F in (*.*) do ss checkin %%~nF%%~xF -C- -K- -P $/project/DBScripts/server/database/StoredProcedures -W

cd ../../../..

Note: SourceSafe's "-R" command is inconsistent. I'd rather loop through all subfolders manually and do "for %%F in (.)" commands.

Upvotes: 0

Views: 886

Answers (1)

flysakura
flysakura

Reputation: 380

Possible reason is the checkin command is executed before prior add/checkout commands are finished. Try checking if add is successful before the checkout command, and checking if checkout is successful before the checkin command.

Upvotes: 1

Related Questions