Tuesday, 26 August 2008

TFS Command line (un)locking a file

I locked a file to prevent other users being able to checkin as I was doing radical surgery on it. This is something I hardly ever have to do with TFS but I was justified in this case. Since I use the command line I found that the easiest to issue a

tf lock /lock:checkin somefile.xml



However when unlocking it I discovered no unlock command. Rather you have to




tf lock /lock:none somefile.xml



This is (IMO) a real programmer choosing an API that is sensible for them (lock a file with no lock) but opaque to the new user. As I write lots of little tools/scripts etc, it's made me think about API discoverablility/design for the future.

No comments: