July 2, 2009

All about the .MySCMServerInfo file

Surround SCM
Recently there have been a couple posts about moving working directories and the .MySCMServerInfo file. Some users are not sure what this file is, what it is for, and what it does. During one of my on-site visits, a user thought that the application was being used incorrectly because all of these strange .MySCMServerInfo files kept popping up in every working directory. Even as the user deleted the .MySCMServerInfo files, they kept coming back! Following are some of the ways that Surround SCM uses the .MySCMServerInfo file: File Status The main purpose of the .MySCMServerInfo is to give you a quick status of your local files. The status is a comparison between your local files and the latest versions in Surround SCM. .MySCMServerInfo contains information about each file's modification timestamp and CRC, which Surround SCM uses when determining the file status. Imagine that you select a view in Surround SCM that shows you several hundred, if not thousands, of files. If Surround SCM had to compare each file, one by one, it would take some time before you were able to see the status of each file. The .MySCMServerInfo file allows Surround SCM to return the status much quicker. [caption id="attachment_645" align="aligncenter" width="250" caption="File status in Surround SCM"]status[/caption] Working Directory Mismanagement The .MySCMServerInfo file in each working directory also stores the branch and repository associated with the working directory. When you try to set the working directory for a branch and repository, and choose a directory that used to be a working directory for another branch and/or repository, you will get a working directory conflict message. This is because Surround SCM sees the .MySCMServerInfo files and sees the references to another branch and/or repository. You can choose to ignore the conflict and move on, but as a best practice you should rarely share the same working directory with another branch because you run the risk of checking in changes to files that do not belong in the current branch and/or repository. [caption id="attachment_647" align="aligncenter" width="479" caption="Working directory conflict message"]Working directory conflict message[/caption] IDE Integration Regardless of the IDE that you use, setting up the integration with Surround SCM can end up saving you a lot of time. Based on my experiences, having your working directory set up first, and doing a get (which creates the .MySCMServerInfo file) before opening the IDE seems to save me a lot of time and hassle. This is because when you tell your IDE that you want to use Surround SCM as your source control provider, the following steps usually take place:
  1. You open the IDE and open the project, workspace, site, solution etc.
  2. You tell your IDE you want to use Surround SCM as your SCC provider.
  3. Your IDE turns SCC control over to the Surround SCM SCCI DLL/ plugin.
  4. Surround SCM looks for a .MySCMServerInfo in the directory where the project, workspace, site, solution, etc. was opened from. If a .MySCMServerInfo file is found, then Surround SCM knows which branch and repository it needs to link to. Otherwise, you will get a message telling you that Surround SCM was not able to determine an association between the directory and a branch/repository in Surround SCM.

Surround SCM IDE message

Most of the binding issues I'm aware of have been because of the .MySCMServerInfo file. Either it is pointing to a different branch/repository than the one you select when you click on the "Fix" button in the previous message,  you are trying to reuse the same working directory, or you tried to outsmart Surround SCM and  modified the .MySCMServerInfo file. Deleting all the .MySCMServerInfo files and doing a get ensures that the files are recreated with accurate information. Deleting the .MySCMServerInfo file The .MySCMServerInfo file is just a text file and, if you delete it, nothing bad is going to happen. The only issue is that your status will be "<unknown>" and your IDE might lose the connection to the Surround SCM branch and/or repository. You could probably run a batch file to delete the files, something like:
del *.MySCMServerInfo /s
To recreate the file simply do a get to the directory where the file was deleted.