2011年3月8日 上午 12:52
We were re-organizing our old code structure to new code structure. There were some old files checked-out by user who no longer exist in version control. To get rid of this we have used TFS Sidekicks 2010 to get rid of old workspace. After this we noticed that one file still says locked, even though We don't see any lock in Solution Explorer, if we try to check-out/move/delete we get an error specifying "$/xxxx/xxx/x.x is locked for check-out by (null) in workspace (null)".
I have tried every possible way, TF lock, TF undo, TFS Sidekick, TF Destroy but with no affect. When I query database I see 4 rows in "tbl_lock" for that particular file.
I have checked internet for similar issues the only one I found was http://social.msdn.microsoft.com/forums/en-US/tfsversioncontrol/thread/00b30775-7552-48c9-a06b-a022fe5c20eb. But, in that case he has physically deleted from database. But we didn't.
We got this source from TFS2005 to TFS2008 to TFS2010, lot of legacy. The workspaces also probably from TFS2008 timeframe. Please anybody could advise me how to proceed would be great. I just don't want to delete the rows directly.
2011年3月8日 上午 07:58版主
Thanks for your post.
In my opinion you have two methods to solve your questions. Please try either of the following two methods:
1). Use the tf lock command to unlock a file:
tf lock $/MyProject/MyPath/MyFile.cs /lock:none /workspacename:WorkSpaceName /server:my_server
Please refer to this article for further information about Lock command:
2). Clear locks for these files directly in the TFS SQL (not a commendatory method)
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
FROM tbl_Lock l
LEFT JOIN tbl_PendingChange pc
ON l.PendingChangeId = pc.PendingChangeId
WHERE pc.PendingChangeId IS NULL
In addition, please also take a look at the following two blogs:
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已標示為解答 rtandra 2011年3月8日 下午 05:00
2011年3月8日 下午 05:00Thanks so much Vicky. I missed Chandru's blog. Thanks for point me. We resolved the issue by running the query you provided.
2012年4月20日 下午 03:52Thanks, i did the 2nd Option (justly that not recommended) and we resolved the problem with the SQL Query.
Non Scripted Human
2012年4月21日 下午 02:39
I just wanted to add that we have resolved this issue structurally for TFS 11. There is no way to have an orphaned lock in TFS 11.
2012年7月16日 下午 08:15
I tried the solutions you guys provided here but with no luck.
I tried the following and it gave me all the orphaned files:
select * from tbl_Lock where workspaceid not in (select workspaceid from tbl_Workspace)
I then when ahead and change that to:
delete from tbl_Lock where workspaceid not in (select workspaceid from tbl_Workspace)
and it did the magic.
Hope it helps anyone having same problem.