Groups > Microsoft > Sourcesafe > Re: Command line Get not setting modified date correctly




Command line Get not setting modified date correctly

Command line Get not setting modified date correctly
Tue, 4 Dec 2007 09:19:21 -0800
For each new version of a product we create a new database by getting
a labelled snapshot from a previous database and creating a new
database from that.  I have been automating this using the command
line SS.  However I have come across a problem; when I do

  SS Get $/MyProject -GTM -GLMyLabel

any files modified since the database was created have the correct
last modified date.  However, any files older than the database itself
end up with the database creation date.

If I use VSS Explorer to manually get the labelled files and select
the "Modified date" in the Advanced options it all works as expected,
and the files that are "older" than the database itself have the
correct dates.

Is there any way to get the same (correct) behaviour from the command
line?  Thanks.


Post Reply
Re: Command line Get not setting modified date correctly
Wed, 5 Dec 2007 06:29:12 -0800
Replying to myself,  but I thought I would document this here in case
anybody else ever needs to find a solution.

In the end I gave up using the command line SS and switched to using
the VSS Automation interface,  which does behave properly regarding
the dates.

The following (incomplete) sample might help you:

--------------------------------------------------------------------------------
----------------

paramVSSLocation = "C:\MyDB"
paramGetLabel = "MyLabel"

' Open SourceSafe
Set oVSSDatabase = CreateObject("SourceSafe")
oVSSDatabase.Open oFSO.BuildPath(paramVSSLocation,"srcsafe.ini"),
"admin", "4sdf23gf4"

' Get the top level list of projects and get the labelled code for
each one
Set oVSSProject = oVSSDatabase.VSSItem("$/", False)
For Each oVSSRecObject In oVSSProject.Items(False)
	if (oVSSRecObject.Type = VSSITEM_PROJECT) then

		' Find the labelled version
		bFoundLabel = false
		For Each oVSSVersion In oVSSRecObject.Versions
			If Left(oVSSVersion.Action, 5) = "Label" Then
				if (StrComp(oVSSVersion.Label,paramGetLabel1,1) = 0) then

					WScript.Echo "Getting " & oVSSRecObject.Name
					strProjPath = oFSO.BuildPath( paramTempLocation,
oVSSRecObject.Name )

					' Get the VSSItem for the version
					Set oVSSItem = oVSSRecObject.Version( oVSSVersion.VersionNumber )
					' There is a deeply strange bug in VSS - you need to prepend a
null string before the path on Get,
					' otherwise it fails with "Type mismatch" - presumably it fails
to see it as a string for some reason
					oVSSItem.Get "" & strProjPath, VSSFLAG_RECURSYES +
VSSFLAG_FORCEDIRNO + VSSFLAG_TIMEMOD

					bFoundLabel = true

					Exit For
				end if
			End If
		Next

		if (Not bFoundLabel) then
			WScript.Echo "Could not find the label " & paramGetLabel &
" on the
project " & strProject & ". Aborting."
			WScript.Quit -1
		end if

	end if
Next

--------------------------------------------------------------------------------
----------------

If anybody does know a solution using the command line please let me
Post Reply
about | contact