如果TFS中的文件被别人锁定了怎么办?

发布于 2024-07-09 00:08:55 字数 70 浏览 5 评论 0原文

有人离开了组织,但在离开之前,他以未知的原因锁定了所有文件。

如何将它们全部解锁以便其他开发人员可以工作?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

在梵高的星空下 2024-07-16 00:08:55

对于以下操作,您需要是要撤消签入的项目的项目管理员,或者如果您想在所有项目中执行此操作,则需要是 Team Foundation 管理员。

如果您仍然拥有此人的用户名,则可以简单地执行以下操作:

  • 打开 Visual Studio 命令提示符(开始 -> 程序 -> Microsoft Visual Studio 200X -> Visual Studio 工具 -> Visual Studio 200X 命令提示)
  • 运行以下命令:

tf 锁 /lock:无
/workspace:工作空间名称;用户名
/递归$/

要获取用户的工作区列表,只需在同一提示符下运行以下命令:

tf 工作区 /所有者:用户名

有关更多命令,请检查 tf /?

For the following operation, you will need to be either a project administrator for the project you want to undo the check-in on or a Team Foundation Administrator if you want to do this across all projects.

If you still have the username of the person, you can simply do something like this:

  • Open up Visual Studio command prompt (Start -> Programs -> Microsoft Visual Studio 200X -> Visual Studio Tools -> Visual Studio 200X Command Prompt)
  • Run the following command:

tf lock /lock:none
/workspace:WorkspaceName;USERNAME
/recursive $/

To get the list of workspaces for a user, just run the following command from the same prompt:

tf workspaces /owner:username

For more commands, check tf /?

信愁 2024-07-16 00:08:55

如果开发人员已经离开组织,那么最好的办法就是删除他们的工作区。 这将为您解锁文件,同时也释放服务器上的一些资源。

请参阅几年前我就该主题所做的以下博客文章。

http://www.woodwardweb.com/vsts/unlocking_files.html

您可以删除使用命令行 (tf.exe) 访问工作区,或者您可以使用以下优秀的 TFS Sidekicks阿特里斯。

If the developer has left the organization, then the best thing to do is to delete their workspaces. This will unlock the files for you but also free up some resources on the server.

See the following blog post I did on the topic when it happened to me a few years ago.

http://www.woodwardweb.com/vsts/unlocking_files.html

You can either delete the workspace using the command line (tf.exe) or you can use the excellent TFS Sidekicks from Attrice.

冧九 2024-07-16 00:08:55

这是我解决此问题的唯一方法,其中涉及删除用户的工作区。

如果错误消息显示“项目 $/... 已被工作区 someMachine123 中的 someUser:1 锁定以供检出。” 然后我使用命令:

tf workspace /delete /server:http://machinename:8080/tfs/DefaultCollection someMachine123;someUser:1

集合 URL 和 someMachine123;someUser:1 之间只有一个空格。

请注意,我注意到错误消息提到用户为 someUser:1,因此我在命令中模仿了这一点。 仅使用 someUser 运行命令是不够的。 我不确定 :1 是什么意思,但重点是,模仿错误消息。

请注意,服务器必须是完全限定的集合路径,您可以通过转到 Team Foundation Server 管理控制台 -> 应用程序层 -> 团队项目集合来找到该路径,底部窗格将显示在中选择的集合的 URL上窗格。

我也遇到了一个问题,因为我不小心尝试使用复数 workspaces 而不仅仅是 workspace 因为有一个类似的复数命令。

This was the only way I resolved this, which involved deleting the user's workspace.

If the error message says "The item $/... is locked for check-out by someUser:1 in workspace someMachine123." then I use the command:

tf workspace /delete /server:http://machinename:8080/tfs/DefaultCollection someMachine123;someUser:1

There is just a single space between the collection URL and someMachine123;someUser:1.

Note that I payed attention to the fact that the error message mentioned the user as someUser:1, so I mimicked that in the command. It was not enough to just run the command with someUser only. I'm not sure what the :1 is all about but point being, mimick the error message.

Note the server has to be the fully qualified collection path, which you can find by going to Team Foundation Server Administration Console->Application Tier->Team Project Collections, the bottom pane will show a URL for the collection that is selected in the upper pane.

I also had a problem because I accidentally tried to use plural workspaces instead of just workspace because there is a similar command that is plural.

以为你会在 2024-07-16 00:08:55

首先你需要有权利这样做。 如果您有,最简单的方法是使用来自 attrice http://www.attrice.info/ 的 TFS sidekicks厘米/tfs/

first you need to have the right to do this. If you have that the easiest is to use TFS sidekicks from attrice http://www.attrice.info/cm/tfs/

一桥轻雨一伞开 2024-07-16 00:08:55

这里< /a> 使用 TFS 权限的说明。

具有“解锁其他用户的更改”
需要将权限设置为允许
删除另一个用户持有的锁。

Here's an explanation of using TFS permissions.

Having the "Unlock other user's changes"
permission set to Allow is required to
remove a lock held by another user.

鹿! 2024-07-16 00:08:55

我需要添加 /collection:collectionURL 否则无法找到工作区:

  • List item

tf loc /lock:none /workspace:WorkspaceName;UserName /collection:collectionURL

I needed to add /collection:collectionURL otherwise the workspace could not be found:

  • List item

tf loc /lock:none /workspace:WorkspaceName;UserName /collection:collectionURL

漫漫岁月 2024-07-16 00:08:55

让系统管理员重置该用户密码,以该用户身份登录,解锁所有文件...

我认为这是几乎所有“不再在该组织中的人”问题的解决方案...

Have a system administrator reset that users password, log on as that user, unlock all files...

I would think this is the solution to almost all 'someone who is no longer at this organization' questions...

绝對不後悔。 2024-07-16 00:08:55

最好从服务器中删除该用户的工作区。 示例

tf工作区 /delete /server:your_tfs_server 工作区;用户名

It is better to delete the workspace of that user from the server. example

tf workspace /delete /server:your_tfs_server workspace;username

往昔成烟 2024-07-16 00:08:55

有时,这掩盖了另一个用户锁定完全不同的应用程序的不同问题,但您甚至无法为要合并到的新项目创建新文件夹(目标不允许创建并错误地指出某人拥有文件被锁定在他们的名字中),但当你深入挖掘时,另一个项目就是罪魁祸首。

因此,完全不同的项目可能会出现文件被其他人锁定的问题。

Sometimes this is masking an different problem with a completely different application is locked by another user, but you cannot even create a New Folder for the new project you wish to merge into ( target won't allow the creation and incorrectly stating that someone has a file locked in their name) but then you dig deeper and another project is the culprit.

So a completely different project can be the problem with it having files locked by someone else.

南巷近海 2024-07-16 00:08:55

对我有用的方法,我的帐户对 TFS 和项目具有管理员权限:

在 Visual studio 2015 中:

  1. 转到团队资源管理器
  2. 右键单击您的解决方案并选择打开在源代码控制中
    exporer
  3. 在左侧单击您的解决方案的右侧
  4. 选择高级
  5. 选择锁定...
  6. 在左侧单击您的解决方案的右侧
  7. 选择高级 >
  8. 选择解锁(现在您可以选择解锁)

现在,每个开发人员都可以轻松提交他的更改:)

Method that worked for me, my account has administrator permission on TFS and project :

In Visual studio 2015:

  1. Go to Team Explorer
  2. Click right on your solution and choose Open in source control
    exporer
  3. On left side click right on your solution
  4. Choose Advanced
  5. Choose Lock...
  6. On left side click right on your solution
  7. Choose Advanced
  8. Choose Unlock (Now you can choose unlock)

Right now, every dev can easily commit his changes :)

活雷疯 2024-07-16 00:08:55

通过使用 TFS 权限,
打开 Visual Studio 命令提示符,运行以下命令:

tf undo /workspace:workspaceName;DomainName\UserName  $/file path in your solution

by using TFS permissions,
Open up Visual Studio command prompt,Run the following command:

tf undo /workspace:workspaceName;DomainName\UserName  $/file path in your solution
吾性傲以野 2024-07-16 00:08:55

将此解决方案用作最后的手段

我正在使用 TFS 2012。我进入 TFS 数据库并运行以下查询。 它成功了! 当然,在处理数据库、进行备份等时要非常小心。

数据库名为Tfs_<>。 忽略 Tfs_Configuration MSSQL 数据库。 我不确定,但如果您没有 Tfs_<数据库,设置可能位于 Tfs_DefaultCollection 数据库中。 锁存储在tbl_PendingChange.LockStatus中。

/*Find correct row*/
SELECT LockStatus, PendingChangeId, *
FROM tbl_PendingChange
WHERE TargetServerItem like '%<<fileName>>%'

/*Set lock status to NULL (mine was set to 2 initially)*/
UPDATE tbl_PendingChange SET LockStatus = NULL WHERE
TargetServerItem like '%<fileName>>%'
AND PendingChangeId = <<PendingChangeId from above>>

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_<<your_TFS_collection_name>>. Ignore the Tfs_Configuration MSSQL database. I'm not sure but if you don't have a Tfs_<<your_TFS_collection_name>> 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 '%<<fileName>>%'

/*Set lock status to NULL (mine was set to 2 initially)*/
UPDATE tbl_PendingChange SET LockStatus = NULL WHERE
TargetServerItem like '%<fileName>>%'
AND PendingChangeId = <<PendingChangeId from above>>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文