November 28, 2005

Using SourceSafe: Get by Date

If you are unable to use an alternative to SourceSafe like Subversion which works great on Windows, you may want to learn to use certain SourceSafe features which are not available through the visual interface.

Recently I needed to get a snapshot of the code base from a point in time to correct an issue in Production after we have done much new development. Normally with CVS or Subversion I would create a branch which represents the snapshot which is being deployed to Production and then tag the immediate release and each sub release. Unfortunately SourceSafe does not support branching and tagging with the same ease that CVS and Subversion do. For example, SourceSafe has the concept of Labels, but it is not the same as tagging. You can actually put an identical label onto different versions of a file. You can hardly base a snapshot on labels due to that flawed feature.

To overcome this broken functionality some developers will label their code using a date/time stamp, like 2005_10_27_RELEASE_3_1. This can be helpful if you need to know something about an individual file. It just cannot be used in the same way tags are used in CVS and Subversion, but it does give you a pragmatic way to at least logically give the files a unique label.

Fortunately you can pull code from a certain point in time. This will allow you to revert your working files to support an older release. To do this you must use the command-line because Visual SourceSafe does not provide this functionality. To use the command-line, you must set the Environment Variable for SSDIR to the location of your SourceSafe database, such as \\Dev1\VSS where Dev1 is the name of the server and VSS is the name of the share where the database is located. Then create an empty folder and run the following command from the command prompt while in that directory:

ss get $/Project.root to . -vd10/27/2005 -R

This command will recursively pull all files for Project.root from 10/27/2005 to that directory. It may ask you to set your default directory for the project to this folder. Since you likely have a working copy for current development attached to another folder you do not want to do that. In fact, it is best to detach this new folder from SourceSafe entirely after you pull this snapshot as you cannot check in any changes because they may not work with your current development. Perhaps you could create a new project in SoureSafe to hold this snapshot as a sort of manually managed branch. And if you choose to do that, I suggest using WinMerge to help shuttle changes between the two working folders.

Good luck!


Posted by brennan at November 28, 2005 10:47 AM | TrackBack
Comments
Post a comment

Comment Rules

Express your opinions and provide feedback, but abide by the following guidelines:

  1. Use language appropriate to civil conversation. Profanity is not acceptable.
  2. Innuendo is not allowed. If you have a point, make it clearly.
  3. Insults towards the site author or the author of a comment will not be tolerated. The point is to provide a healthy exchange of viewpoints.
  4. Comments must pertain to the topic of the blog entry.

Comments which do not abide by the rules will be deleted.










Remember personal info?







[ Home ]