Python Reads SourceSafe

Picking up an example presented in 1998 for using COM Automation on SourceSafe from Visual FoxPro, I created the same example in Python with just as little code. Using Mark Hammond's Win32All to supply the Win32 and COM support, the following code will list all the files in a particular SourceSafe project and their version numbers.


import win32com.client

SSafe=win32com.client.Dispatch("SourceSafe")
SSafe.Open("c:\Projects\VSSPath\srcsafe.ini","troche","secret")

Root=SSafe.VSSItem("$/MyClient/MyProject")
VSSItems=Root.Items

print VSSItems.Count
for loNode in VSSItems:
	print loNode.Name, loNode.VersionNumber

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.