开发者

TFS claiming files are locked even though they are not - Orphaned Locks

I'm trying to perform a baseless merge between two branches using tf.exe.

When I run the command, it fails and tells me that there 15-20 files that are locked by another user. I've looked at the other user's pending changes and he only has three files checked out in 开发者_运维百科the target branch and none of them are locked.

Has anyone experienced something similar to this before?

Edit

With help from Robaticus, I've found that the locks are in the tbl_lock table, but the pending changes they are associated with do not exist any more. It looks like there are multiple orphaned locks other than the ones that are giving us the current merge issue.

Does anyone know what causes these or a way of fixing them that does not involved touching the DB directly? I'm off to do a little research to see if I can find anything.

Edit 2

First Google search for 'tfs orphaned locks' returns this: Orphaned locks in TFS

The TFS team recommends deleting them directly from the table, so I guess I'll have to do that.

I didn't see any posts indicating that it had been fixed yet.


You may want to check to see if they are locked in an abandoned workspace. To do this, install the TFS Power Tools (October edition) for TFS 2008. Then you can right click on a folder in the source explorer and "Find in source control." Use the "Status..." and you can find all files that are locked by that user.

If you have administrative rights, you can selectively remove the locks from any locked files.

* EDIT: Dangerous Code Ahead *

The code below can be executed against the TFSVersionControl database. This will show you all files that are locked. This might tell you if you have an orphaned file out there somewhere.

I wouldn't recommend that you make any changes within that database, and, of course, always make sure you have a current backup of your repository before you ever do something like this.

select 
    lck.FullPath,
    wspc.WorkSpaceName,
    id.DisplayName
 from tbl_lock lck
inner join tbl_workspace wspc on wspc.WorkSpaceId = lck.WorkSpaceId
inner join tbl_identity id on id.IdentityId = wspc.OwnerId


Did you use the Attrice Sidekicks to look into this issue. It is a nice UI around the commandline tools of TFS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜