What do you do if the file in TFS is locked by someone else?

后端 未结 11 912
梦如初夏
梦如初夏 2020-12-23 13:35

Someone left the organisation but before leaving, he locked all the files for an unknown reason.

How do you unlock them all so that the other developers can work?

11条回答
  •  忘掉有多难
    2020-12-23 14:03

    Use this solution as the very last resort.

    I’m using TFS 2012. I went to the TFS database and ran the following queries. And it worked! Of course be very careful when messing with the database, take backups, etc.

    The database is called Tfs_<>. Ignore the Tfs_Configuration MSSQL database. I'm not sure but if you don't have a Tfs_<> database, settings might be in the Tfs_DefaultCollection database. Locks are stored in tbl_PendingChange.LockStatus.

    /*Find correct row*/
    SELECT LockStatus, PendingChangeId, *
    FROM tbl_PendingChange
    WHERE TargetServerItem like '%<>%'
    
    /*Set lock status to NULL (mine was set to 2 initially)*/
    UPDATE tbl_PendingChange SET LockStatus = NULL WHERE
    TargetServerItem like '%>%'
    AND PendingChangeId = <>
    

提交回复
热议问题