简体   繁体   中英

Programmatically check if file is checked out in TFS

I would like to check out various files, edit them and check them back in. However, I do not wish to edit files that are already checked out so I would like to check for this before I make a call to Microsoft.TeamFoundation.VersionControl.Client.Workspace.PendEdit method. I could go through the following procedure:

Call GetPendingChanges
Store the pending changes in a list
Check if the file I am about to edit is in that list
Skip the checkout if it is in the list, proceed with checkout if it is no in the list.

However, I was hoping that there wass there a method I could call on the to do this. That is, one that returns a bool (or int, or enum) telling you if a file is checked out. I have looked, but can't find one.

You can check the permissions of the file - readonly or not. Also store them in a dict, not list. Finally, there are GUI tools which integrate with TFS and do exactly what you are trying to program. There is also a command-line way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM