Date a file was deleted

Jun 13, 2012 at 12:09 AM
Edited Jun 13, 2012 at 12:11 AM

Note: I am using VSS 6.0d, perhaps VSS 2005 is different.

How do you find out when a file was deleted?

Calling get_Versions() returns a list of all versions of a file. Each version has a string property called Action. A separate version is returned for each event that has occurred for that file, such as created, labeled, checked in etc, but not deleted.

This webpage http://msdn.microsoft.com/en-us/library/bb509341%28v=vs.80%29.aspx lists the following possible values for the Action property:

Added
Branch at version <version number>
Checked in <SourceSafe file path>
Created
Deleted
Destroyed
Labeled <label>
Moved <old SourceSafe path> to <new SourceSafe path>
Renamed <old name> to <new name>
Shared <SourceSafe file path>

I am yet to see the Action property contain the string Deleted, and I don't see how it is possible to ever contain Destroyed.

The IVSSItem property Deleted is not much use, as it is just a Boolean that indicates that the file or project has been deleted, but not when. Displaying a files history using the VSS GUI does display the correct deletion date, so the information is in the database.

 

Jun 13, 2012 at 5:27 AM
Edited Jun 13, 2012 at 5:29 AM

I think I have answered my own question. I was playing with SsPhys from http://code.google.com/p/vss2svn/wiki/SsPhys when I noticed if you list the versions of a project, it contains information regarding any changes to files in the project, including renaming and deleting. If you list the versions of a file directly, you only get when it was created, labeled, checked in etc, but not deleted.

Jun 14, 2012 at 7:33 AM
dkselw wrote:
This webpage http://msdn.microsoft.com/en-us/library/bb509341%28v=vs.80%29.aspx lists the following possible values for the Action property:

Added
Branch at version <version number>
Checked in <SourceSafe file path>
Created
Deleted
Destroyed
Labeled <label>
Moved <old SourceSafe path> to <new SourceSafe path>
Renamed <old name> to <new name>
Shared <SourceSafe file path>


This page http://msdn.microsoft.com/en-US/library/microsoft.visualstudio.sourcesafe.interop.ivssversion.action%28v=vs.80%29 lists 19 actions.

Jun 14, 2012 at 7:51 AM
dkselw wrote:

I think I have answered my own question. I was playing with SsPhys from http://code.google.com/p/vss2svn/wiki/SsPhys when I noticed if you list the versions of a project, it contains information regarding any changes to files in the project, including renaming and deleting. If you list the versions of a file directly, you only get when it was created, labeled, checked in etc, but not deleted.

If a file has been deleted from a project, SsPhys does return the date and the name of the file deleted when applied to a project file, however looking at the info returned by get_Versions() when applied to a project item, I can only see when a file was added to or deleted from a directory, but not the name of the file that was added or deleted. The name of the file is included when a file is committed though.

Jun 18, 2012 at 2:31 AM

The easiest method I have found so far for finding the date when files are deleted, is simply to compare the versions of a project. When a file is deleted, VSS will store a new version of the project with the Action property = Deleted, the Date property will contain the date the files were deleted. If you compare this version of the project to the previous version, you can see which files have been deleted.

Jun 19, 2012 at 12:07 AM
Are you talking about the problem in BuildRevisionList, under

if(version.VSSItem.Deleted)
...

? I'm getting exceptions around versions[versions.Count - 1] .
I've commented out everything under this "if", but then I'm
getting lots of "Invalid svn status detected for ..." .

Are you saying that this "if" code should be different? If you
managed to make it work, could you tell some more?
Jun 19, 2012 at 1:30 AM
Edited Jun 19, 2012 at 1:37 AM

I am only commenting on VSS 6.0d. Someone else will have to comment if this is different with VSS 2005.

If a item has been deleted, version.VSSItem.Deleted returns true for all versions of the item. This does not help us at all when the item may be valid in an older version of a project.

versions.Count is not available in VSS 6.0d, and its use here is probably wrong anyway. The last version of a file item returned by item.get_Versions() is a valid file in the project at the time, and should not be deleted from the project until some later point in time.

My previous post indicates a way you can tell when a file (or project) was removed from a project.

I have not made the code work. I have just been trying to understand how VSS works, so I can start to look at modifying the code to correctly import history with deleted files. SoonerDave has commented he has made some progress. At the moment the only way I can think of getting a reasonable conversion from VSS to SVN, is to sort all VSS actions by time before applying them to SVN. This means creating and deleting directories and files in SVN in the same order they were created in VSS (with some merging of versions). I would be interested if anyone has any comment on this.

I have not even looked at shared files yet. The VSS database I am looking at has no shared files, however I do have other VSS databases to convert that do use shared files.

Jun 22, 2012 at 12:57 AM

"Invalid svn status detected for ..." messages, as it looks now to me, are for different reason - the status of an entry (directory?) loses all events as soon as the entry is commited to Subversion. SvnClient.GetStatus question is asked here - http://sharpsvn.open.collab.net/ds/viewMessage.do?dsForumId=728&dsMessageId=460026 .

Now the question is, how to avoid having files which are deleted in SourceSafe to appear in the Subversion after migration? It seems several people are working on this issue.

Jun 29, 2012 at 7:34 AM
Edited Jun 29, 2012 at 7:37 AM
barrafish wrote:

"Invalid svn status detected for ..." messages, as it looks now to me, are for different reason - the status of an entry (directory?) loses all events as soon as the entry is commited to Subversion. SvnClient.GetStatus question is asked here - http://sharpsvn.open.collab.net/ds/viewMessage.do?dsForumId=728&dsMessageId=460026 .

This has been answered by Bert Huijben here http://stackoverflow.com/questions/11130666/svnclient-getstatuspath-args-statuses-returning-0-for-versioned-file/11256603#11256603

barrafish wrote:

"Now the question is, how to avoid having files which are deleted in SourceSafe to appear in the Subversion after migration? It seems several people are working on this issue.

I think the question is more about svn reflecting the complete history in vss. Not just the most recent version.