Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to track "links/shares" between projects/files... 1

Status
Not open for further replies.

Klyn610

MIS
Jan 8, 2007
11
US
Hello

VSS stores information on every file and project - one is the "sharing" or "links" aspect. This can be very useful, but if you run into a lot of projects that branch off eventually or certain files branch off, there is just no way to figure this out without looking at the properties of every file in every project.

What I am looking for is some sort of report or SQL interface so that I might write a query (even a command line script at this point) that will extract the information that I KNOW is being stored in VSS so that I can monitor projects for broken links, unexpected shares, and project management.

ANY help with this would be greatly appreciated.

I've done a lot of searching so far and I've not come up with much. I found a 3rd party reporting tool (VSS Data Export) on that exports your VSS database to an Access database and I'm playing around with that - but it only creates 4 tables and it doesn't seem to contain the information I am looking for.

Basically, I need a report that lists all files that have shares, and with whom they are shared, the relationship (parent/child) - also if an entire project (recursive) is shared, the same information for the project...

Does anyone know what I'm talking about?

PLEASE HELP

Thanks so much!!!

Keri-Lyn
 
Hi Keri-Lyn,

Not 100% sure this will do you job, but should be a starting point at least for you. It is in VB6, so I hope that is OK. Just add a form with an OK button and add this code to it.

'=======================================================

Option Explicit
Dim objVSSDatabase As New VSSDatabase

Private Sub cmdOK_Click()
'
'Open database using login and password
objVSSDatabase.Open "\\192.0.0.3\vss\srcsafe.ini", "user", "password"

'process initial source folder
Call ProcessFolder("$\Source\Branch1")

'
End Sub

Private Sub ProcessFolder(ByVal StrSource As String)


Dim objVSSRoot As VSSItem
Dim objItems As VSSItem
Dim objItem As VSSItem
Dim intMaxVersion As Integer
Dim intLinkCount As Integer

'open up the paths
Set objVSSRoot = objVSSDatabase.VSSItem(StrSource, False)
'
'Grab all the items from the Path
For Each objItems In objVSSRoot.Items
'Get the latest version number
intMaxVersion = objItems.VersionNumber
'Open file
Set objItem = objItems.Version(intMaxVersion)

'If folder then call this routine again with new path to process folder
If objItem.Type = 0 Then
Call ProcessFolder(StrSource & "\" & objItem.Name)
End If

'All files have one link, if mulitple the show paths where links are.
If objItem.Links.Count > 1 Then
For intLinkCount = 1 To objItem.Links.Count
MsgBox objItem.Links.Item(intLinkCount).LocalSpec
Next intLinkCount
End If

Next

Set objVSSRoot = Nothing


End Sub
'=======================================================


Regards,


Hammy.
 
Soz,

Forgot you also need to add a reference to the VB6 app to Microsoft SourceSafe 6.0 Type Library. In my case this is
c:\program files\vss\win32\SSAPI.DLL


Hammy.
 
Hi Hammy

Thank you so much for this piece of code. I'm going to try to get this to work because the need to track shared files in projects is becoming extremely necessary - for example - today, we had an error in our build because a file had been added to the parent project (Project1). We were building Project 2, which is "shared" with Project 1. Unfortunately, when you add a new file to Project 1, it does not propagate to Project 2. I had to go into Project 2 and manually share this file with it.

What kind of output should I expect from running this? I'm not terribly familiar with VB6 but know enough to get around. I'm more of a SQL gal, if only I could get the information I need exported to tables!

Thank you thank you thank you!! I'll let you know how it goes.

KLM
 
Hi Keri-Lyn,

Try this code, it will create a comma separated file called c:\ss.csv that you could import into SQL I am sure.
'=================================================
Option Explicit
Dim objVSSDatabase As New VSSDatabase
Dim intFreeFile As Integer

Private Sub cmdOK_Click()
'

'Open database using login and password
objVSSDatabase.Open "\\192.0.0.3\vss\srcsafe.ini", "user", "password"

'process initial source folder
intFreeFile = FreeFile
Open "c:\SS.csv" For Output As #intFreeFile
Call ProcessFolder("$\Source\Branch1")
Close #intFreeFile

Unload Me
'
End Sub

Private Sub ProcessFolder(ByVal StrSource As String)


Dim objVSSRoot As VSSItem
Dim objItems As VSSItem
Dim objItem As VSSItem
Dim intMaxVersion As Integer
Dim intLinkCount As Integer
Dim strLine As String

'open up the paths
Set objVSSRoot = objVSSDatabase.VSSItem(StrSource, False)
'
'Grab all the items from the Path
For Each objItems In objVSSRoot.Items
'Get the latest version number
intMaxVersion = objItems.VersionNumber
'Open file
Set objItem = objItems.Version(intMaxVersion)

'If folder then call this routine again with new path to process folder
If objItem.Type = 0 Then
Call ProcessFolder(StrSource & "\" & objItem.Name)
End If

'All files have one link, if mulitple the show paths where links are.
strLine = ""
For intLinkCount = 1 To objItem.Links.Count
If Trim$(objItem.Links.Item(intLinkCount).LocalSpec) <> "" Then
strLine = strLine & objItem.Links.Item(intLinkCount).LocalSpec & ","
End If
Next intLinkCount

Print #intFreeFile, strLine

Next

Set objVSSRoot = Nothing


End Sub

'=================================================

Regards,

Hammy.
 
Hammy, you're a godsend!

We did get the code to work (funny, I couldn't get it to work in plain old VB, but it worked in Access using a form there... strange!) anyway, figured the output was a message box (duh!) and we are looking and modifying it. This is great! "If you can't find the tool you're looking for, then make it yourself".

Anyway, I just wanted to say thank you again for helping out a poor soul.

You rock!
KLM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top