get VSS files based on label
get VSS files based on label
(OP)
I understand that this can only be accomplished via command line, but command line asks for authentication which does not work !!! Here is my command line:
C:\"Program Files\Microsoft Visual Studio\VSS\win32"\SS GET $/VSSTEST/*.* -r -vlLABEL1
I found http://support.microsoft.com/kb/151354/en-us which talks about authenticating when using vss command line. This confused the matters more !!! I came up wit the following but it does not work an I do not understand why because I am not a VB expert. Can anyone help PLEASE... The above website lead me to create the following code...
Const InvalidPath = 0
Const InvalidUserName = 1
Const InvalidPwd = 2
Const Success = 3
Declare Function Login lib "C:\Program Files\Microsoft Visual Studio\VSS\win32" (ByVal szUserName as String, ByVal szPassword as String, ByVal szUMPath as String) as Integer
Sub Main()
Dim RetVal as integer
Dim UserName, Password, UMPath as string
UserName = “myusername”
Password = “mypassword”
UMPath = “C:\Program Files\Microsoft Visual Studio\Vss\Data\UM.DAT”
RetVal = Login(UserName, Password, UMPath)
‘ All return error processing goes here
C:\"Program Files\Microsoft Visual Studio\VSS\win32"\SS GET $/VSSTEST/*.* -r -vlLABEL1
I found http://support.microsoft.com/kb/151354/en-us which talks about authenticating when using vss command line. This confused the matters more !!! I came up wit the following but it does not work an I do not understand why because I am not a VB expert. Can anyone help PLEASE... The above website lead me to create the following code...
Const InvalidPath = 0
Const InvalidUserName = 1
Const InvalidPwd = 2
Const Success = 3
Declare Function Login lib "C:\Program Files\Microsoft Visual Studio\VSS\win32" (ByVal szUserName as String, ByVal szPassword as String, ByVal szUMPath as String) as Integer
Sub Main()
Dim RetVal as integer
Dim UserName, Password, UMPath as string
UserName = “myusername”
Password = “mypassword”
UMPath = “C:\Program Files\Microsoft Visual Studio\Vss\Data\UM.DAT”
RetVal = Login(UserName, Password, UMPath)
‘ All return error processing goes here
RE: get VSS files based on label
-Y allows you to specify the user name and password
-S allows you to specify where your source safe database is
You will also need to check that the Windows User that you are running the command as has access to the directory & share that the source safe database is sitting in.
CODE
By the way, is it giving you some kind of error message?
RE: get VSS files based on label
This is what my code does (in a bat file):
set ssdir=\\server_name\\vss_dir
set ssuser=My Username
REM Prompt for label name
set /P A="Enter the label for this Build: "
if "%A%"=="" set A=TempLabel
"C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS" Label $/Java -L%A% -Cnocomment -I-Y >> Build_Vigilare.log
@echo Getting latest Java sourcesafe Files...
REM 1/30/07 - getting Java Files...
"C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS" cp "$/Java"
"C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS" Workfold "c:\build\Java"
"C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SS" Get "$/Java/*.*" -vl%A% -gf -I-Y >> Build.log
I did it this way (finally) because of help from this article:
http://support.microsoft.com/kb/196599/en-us
Hope this helps
RE: get VSS files based on label
RE: get VSS files based on label
Your email helped me a lot in resolving my problem. It opened a lot of doors. The authenticaion issue had nothing to do with real authenticaion! I only needed to set ssdir to the appropriate location !! Very unintuitive !!!! In any case, just in case this may help others, here is what I ended up with which works just fine.
I was able to do exactly what I had intended which was to get files form VSS using a specific label which had been assigned to the files throughout the file structure. This is very simple but it does the trick.
1) Must set the following environment variable:
ssdir=<location where srcsafe.ini resides>
ssuser=<username used to log into a vss account>
sspwd=<password for the login used above>
2) Must create the directory name where the files will be extracted into from VSS. You need only the top folder, as the script will recursively create the subfolders as it find files which it needs to extract.
3) Here is the content of the .bat file:
' the @ in front of each line masks the text from showing in the command line when executing the script
@echo.
' this is just a title
@echo ***** Batch Release *****
@echo.
' the caused set commands to only create temporary env. var. tied to session, when sessions is gone, so are the
variables.
@setlocal
' this prompts for working dir where files will go
@set /p A="Enter the working directory for this build:"
@echo.
' this prompts for label to look for
@set /p B="Enter the label for this Build:"
@echo.
' this line below looks in $/vsstest and all subdirectories
' then it uses the username/pwd entered as env. variables
to log into VSS
' then it finds all files that are labeled as what user entered as parameter B
' then extracts these files into the c:\ directory which user entered as a parameter A
' then the result is redirected into Buid_Result<label>.log for user to view
ss get $/vsstest/*.* -Y -r -gf -I -glc:\%A% -vl%B% >> Build_Result%B%.log
' this end the set local var. command
@endlocal
RE: get VSS files based on label
Although, be sure to read the article I pasted - only because there is a setting in the VSS GUI (always do recursive or something like that) - somehow, even though I run Analyze weekly, from moving projects around, sometimes I would get "file not found" (there's another thread on this forum for that) in a directory structure, and it would just stop. That's what the article points to, the fact that it IS a known bug in VSS and the workaround.
Yes, I believe if you don't set ssuser, it defaults to "guest" and "guest" doesn't have "get by label" permissions (that is my impression as I've tried both).