views:

407

answers:

2

Hi all,

I'm using Visual Source Safe 6.0d (work requirement) and I've been trying to hack together a little shell script to allow me to easily remove a source tree or warn me if I've got files checked out so I can make sure I don't accidentally delete work. Is there any way to tell if files are checked out other than checking the read-only bit on the files themselves?

  1. VSS doesn't seem to be writing any file (I took a snapshot of the dir before and after checking out a file and there was no difference in the files listed)
  2. I can't seem to find anything by Googling.
  3. I also checked the vssver.scc for differences and didn't find anything.

Mind you, checking for writeable files isn't the worst thing in the world but it seems as if VSS makes several files in the source tree (*.ncb, *.scc, *.sln) writeable without me having checked anything out. I can simply exclude the files but I'm trying to find a bit more elegant solution.

+3  A: 

You can use COM to check if a file is checked out. Take a look at the IVSSItem.IsCheckedOut property. For more on using VSS through COM see:

http://msdn.microsoft.com/en-us/library/4d44xhsd%28VS.80%29.aspx

heavyd
Thanks--this is what I'm looking for.
Onorio Catenacci
+2  A: 

Perhaps the most robust technique is to ask SourceSafe itself what is checked out and/or whether individual files of interest are checked out. Whilst I realize that it's not obvious how to do this in a little shell script, I'd advocate the use of PowerShell for this.

SourceSafe exposes an OLE Automation object model (also known as a COM object model), and PowerShell can talk to COM objects. If you're not familiar with this stuff, it's a lot to learn but ultimately it's worth it.

Alternatively, if PowerShell is too alien, VBScript can also be used to control COM objects.

Dan Blanchard