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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Big Problem in MS Visual SourceSafe.

Status
Not open for further replies.

dazdar

Programmer
Apr 19, 2006
4
IE
Hi there,we have been using MS Visual Source Safe 6.0 within our organisation for past few years, - but Ive just realised Ive made a serious screw up about six months ago. I decided to move the location of some of the folders of code up two levels so each folder would be in a logical location.
I renamed the old folders to _OLD.
However, all the history in the new folder has been completely lost, all it contains is the date the new folder was created and the files added to it.
I realise know that I should have used the Move project functionallity in source safe to complete this / and not re create the projects again!
I now have a scenario where there are lots of changes to the code in the new folder, where as the old contains all the history of the code changes prior to the move.
Is there any possible way i can merge the two locations to include the history of the previous code and keep the recent changes intact?
Any help would be appreciated.
Kind regards
D.
 
Do you use comment field when checking changes in, and therefore need to keep this information, or are you just specifically looking to be able to compare versions etc?

Also, are there a lot of changes in the new location?
 
Hi,
We didnt use comments at all, therefore we do not require this information.
I need to compare the two versions and merge any changes between the old and new directories. There are alot of changes > 100 files? many thanks
 
Been looking into this. Should be possible using the SSAPI.DLL and some VB6 code.

Are you still looking for a solution to this? Just before I spend a bit more time on it :)

 
Yes I still am hammy, have tried to use a get on each item in the history and then check back in the code in the old area, but it doesnt work.
 
Hi dazdar,

This code is pretty much untested. I have tested as much as I can up to the point of checking the updated code in, as I did not want to stuff our database up here. And I have not tested for multiple files. Basically it might do your job. If possible test on a backup of your database.

Hopefully I have warned you enough by now :)

Create a VB6 project with a reference added to c:\program files\vss\win32\SSAPI.dll (presuming that is where SourceSafe is installed). Create a command button and then paste this code in.

Please use a backup of your database to prove this works the way you want.

Useful article in case you need to change this in any way.


=========================================================
Option Explicit

Private Sub cmdOK_Click()
'
Call ProcessFiles("$/oldSrouce", "$/NewSource")
'
End Sub

Private Sub ProcessFiles(ByVal strOldSource As String, ByVal strNewSource As String)
'
Dim objVSSDatabase As New VSSDatabase
Dim objOldVSSRoot As VSSItem
Dim objNewVSSRoot As VSSItem
Dim objItems As VSSItem
Dim objoldItems As VSSVersion
Dim objOldItem As VSSItem
Dim objNewItem As VSSItem
Dim objVSSFile As VSSItem
Dim intMaxVersion As Integer
Dim intCounter As Integer

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

'open up the paths
Set objOldVSSRoot = objVSSDatabase.VSSItem(strOldSource, False)
Set objNewVSSRoot = objVSSDatabase.VSSItem(strNewSource, False)

'
'Grab all the items from the New database
For Each objItems In objNewVSSRoot.Items
'Check the max versions. Grabs files back in reverse order.
intMaxVersion = objItems.VersionNumber

'Run through the versions from 1st to last
For intCounter = 1 To intMaxVersion
Set objNewItem = objItems.Version(intCounter)

'Check out the old version, into work folder for new one
Set objVSSFile = objVSSDatabase.VSSItem(objOldVSSRoot.Spec & "/" + objNewItem.Name)
objVSSFile.Checkout "", _
Local:=objNewItem.LocalSpec + objNewItem.Name, iFlags:=0

'Get the copy of the new one
objNewItem.Get Local:=objNewItem.LocalSpec
'Check in the new one
objVSSFile.Checkin "", _
Local:=objNewItem.LocalSpec + objNewItem.Name, iFlags:=0

Set objNewItem = Nothing
Set objVSSFile = Nothing

Next intCounter
Next

Set objOldVSSRoot = Nothing
Set objNewVSSRoot = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top