如何查找已签出的文件
我正在使用 Visual Source Safe 6.0d(工作要求),并且我一直在尝试编写一个小 shell 脚本,以允许我轻松删除源代码树,或者在我签出文件时警告我,以便我可以确保我不会不小心删除工作。 除了检查文件本身的只读位之外,还有什么方法可以判断文件是否已签出?
- VSS 似乎没有写入任何文件(我在签出文件之前和之后拍摄了目录的快照,列出的文件没有差异)
- 我似乎无法通过谷歌搜索找到任何内容。
- 我还检查了 vssver.scc 的差异,但没有发现任何东西。
请注意,检查可写文件并不是世界上最糟糕的事情,但似乎 VSS 使源树中的多个文件(*.ncb、*.scc、*.sln)可写,而我没有检查任何内容。 我可以简单地排除这些文件,但我正在尝试找到更优雅的解决方案。
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?
- 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)
- I can't seem to find anything by Googling.
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 COM 检查文件是否已签出。 查看 IVSSItem.IsCheckedOut 属性。 有关通过 COM 使用 VSS 的更多信息,请参阅:
http:// /msdn.microsoft.com/en-us/library/4d44xhsd%28VS.80%29.aspx
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
也许最可靠的技术是询问 SourceSafe 本身签出了什么内容和/或是否签出了感兴趣的单个文件。 虽然我意识到如何在一个小 shell 脚本中执行此操作并不明显,但我建议使用 PowerShell 为此。
SourceSafe 公开了一个 OLE 自动化对象模型(也称为 COM 对象模型),并且 PowerShell 可以与 COM 对象通信。 如果您不熟悉这些东西,需要学习很多东西,但最终是值得的。
或者,如果 PowerShell 太陌生,也可以使用 VBScript 来控制 COM 对象。
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.